DataFlex
DataFlex
Active and Passive Modes in FTP
See more FTP Examples
The Passive property controls whether data connections for uploads/downloads are established in Active or Passive mode. To use Active mode, set the Passive property = _FALSE_. This is the default. To use Passive mode, set the Passive property = _TRUE_.
About Passive/Active Modes:
Active Mode:
The FTP client chooses a port number and sends a “PORT” command to the FTP server. The FTP client then listens at the chosen port and the FTP server issues a connect request to establish the connection. The data connection is outgoing from the FTP server, and incoming to the FTP client.
Passive Mode:
The FTP client sends a PASV command to the FTP server. The FTP server chooses a port number and sends it in the PASV response. The FTP server then listens at that port for the incoming connect request from the FTP client. The data connection is incoming to the FTP server, and outgoing from the FTP client.
Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoFtp
String sTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatFtp2)) To hoFtp
If (Not(IsComObjectCreated(hoFtp))) Begin
Send CreateComObject of hoFtp
End
Set ComHostname Of hoFtp To "ftp.something.com"
Set ComUsername Of hoFtp To "test"
Set ComPassword Of hoFtp To "test"
// Connect and login to the FTP server.
Get ComConnect Of hoFtp To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoFtp To sTemp1
Showln sTemp1
Procedure_Return
End
// To use Passive mode:
Set ComPassive Of hoFtp To True
// or...
// To use Active mode:
Set ComPassive Of hoFtp To False
// ..
End_Procedure