FtpSetPassiveMode Function  
 
INT WINAPI FtpSetPassiveMode(
  HCLIENT hClient,  
  BOOL bPassiveMode  
);

The FtpSetPassiveMode function enables or disables passive mode file transfers for the specified client session.

Parameters

hClient
Handle to the client session.
bPassiveMode
A boolean flag which specifies that the client should enter passive mode and establish all connections with the server to transfer data.

Return Value

If the function succeeds, the return value is zero. If the function fails, the return value is FTP_ERROR. To get extended error information, call FtpGetLastError.

Remarks

By default, the File Transfer Protocol uses active mode transfers, whereby the data connection is established from the server back to the local client. However, this can introduce problems for a client application that is behind a proxy server, firewall or a router which uses Network Address Translation (NAT). Enabling passive mode transfers instructs the client to create an outbound connection from the local system to the server for the data connection, similarly to how the control connection is established.

Not all servers may support passive mode, in which case an error will be returned to the client when this function is called.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csftpv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

FtpConnect, FtpGetActivePorts, FtpGetData, FtpGetFile, FtpProxyConnect, FtpPutData, FtpPutFile, FtpSetActivePorts