Method FTPClient():connect() Professional

Connects to the FTP server.

:connect( [<nMode>] ) --> lSuccess
This parameter controls how the connection is performed. One #define constant from the ASINET.CH file must be used:
Constant Description
FTP_CONNECT_ACTIVE_MODE (*) In active mode the server connects the data channel to the client
FTP_CONNECT_PASSIVE_MODE In passive mode the client connects the data channel to the server
  1. default

The method returns .T. (true) when a connection to the FTP server is successfully established, otherwise .F. (false) is returned.


This method establishes a connection to the FTP server an FTPClient object is created for. A connection may fail if the object was instantiated with invalid parameters, if the FTP server does not respond or if the user authentication fails. When the connection is successful, files can be exchanged between server and client using the :getFile() or :putFile()methods.

For the FTP protocol, two communication channels are required: the command channel and the data channel. The <nMode> parameter can optionally be used to set the method of how the data channel is connected. In active mode (FTP_CONNECT_ACTIVE_MODE), the server connects the data channel to the client. This implies that the client firewall must allow inbound connections to all ports > 1023. In passive mode (FTP_CONNECT_PASSIVE_MODE), it is the client that connects the data channel to a certain port specified by the server. Since the default firewall setup under Windows allows all outbound traffic, passive mode works without additional firewall setup/configuration.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.