Re: GetFtpConnection Last param, Passive?
- From: Tim Slattery <Slattery_T@xxxxxxx>
- Date: Fri, 09 Sep 2005 12:33:16 -0400
"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
.
- Follow-Ups:
- Re: GetFtpConnection Last param, Passive?
- From: Simon
- Re: GetFtpConnection Last param, Passive?
- References:
- GetFtpConnection Last param, Passive?
- From: Simon
- GetFtpConnection Last param, Passive?
- Prev by Date: Re: SetDialogBkColor in Visual Studio.NET 2003
- Next by Date: Re: Get hWnd for scroll bars (CListCtrl)
- Previous by thread: GetFtpConnection Last param, Passive?
- Next by thread: Re: GetFtpConnection Last param, Passive?
- Index(es):
Relevant Pages
|