Re: GetFtpConnection Last param, Passive?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Simon" <spambucket@xxxxxxxxxxx> wrote:

>Hi,
>
>I am trying to upload file from my computer to our server.
>
>Everything works as expected but I am not sure I understand the last
>parameter.
>
>CFtpConnection* GetFtpConnection( LPCTSTR pstrServer, LPCTSTR pstrUserName =
>NULL, LPCTSTR pstrPassword = NULL, INTERNET_PORT nPort =
>INTERNET_INVALID_PORT_NUMBER, BOOL bPassive = FALSE );
>
>According to the doc "Specifies passive or active mode for this FTP session.
>If set to TRUE, it sets the Win32 API dwFlag to INTERNET_FLAG_PASSIVE. "
>
>What does it do?

FTP clients normally operate in active mode. In that mode, when the
client wishes to transfer a file - either to send or receive a file -
it tells the server that it will listen for a contact on a particular
port (the client tells the server which port). The server then
contacts the client on that port, and that connection is used to
transfer the file. When all the data is transferred, the port is
closed.

In passive mode, the client asks the server to send it a port number
so that it can initiate the contact. The server sends the port number
and begins listening on that port. The client connects to that port,
the data is transferred, and the port is closed.

When you set passive to FALSE, active mode is used. The most likely
reason it fails for you is that you are behind a router doing NAT
(Network Address Translation). The client tells the server to contact
it on some port, at the IP address assigned it by the router - which
is a nonroutable address which is basically made up by the router. The
server cannot make a contact on that address. In this environment you
*must* use passive mode FTP, so that the client can initiate the
contact.

--
Tim Slattery
MS MVP(DTS)
Slattery_T@xxxxxxx
.



Relevant Pages

  • Re: Unable to print to networked printer - get access denied messa
    ... Check the permissions on the server assuming the client has a true RPC ... How is the Standard TCP/IP port configured for the device? ...
    (microsoft.public.windowsxp.print_fax)
  • Re: interfaces lo:1 lo:2 lo:3? (for remote ssh tunnels)
    ... That's the problem tunneling (port forwarding) solves. ... >>can't get past the client firewall. ... > I don't understand why the server would be making the ... server initiates another connection to the client -- in this ...
    (Debian-User)
  • Re: Remote Connection Issue
    ... through port number 3389 and a workstation on the LAN through port number ... I understand that you want to allow a LAN client ... and you have configured server publishing rule ... > By default Terminal Server and Windows 2000 Terminal Services uses TCP ...
    (microsoft.public.windows.server.sbs)
  • Re: RealVNC
    ... Default listening port for RealVNC server that runs on the machine on which ... Then there is default Java listening port on port 5800 on the client machine ...
    (microsoft.public.windows.server.sbs)
  • Re: Redirecting data sent to a local printer to another host and port on the network
    ... All client workstations have access to the ... simply redirecting netcat traffic on port 9100 to port 515 on ... Only LPR clients talk to LPD print server daemons. ... >workstation at the branch site where the print job originated. ...
    (comp.unix.sco.misc)