ftpConnect (Function) |
Top Previous Next |
This initiates a FTP connection to the specified IP address/port number. When this function returns, the connection has been established. For each ftpConnect(), there must be a corresponding ftpDisconnect() even if the connection is closed from the server side (see example below).
It is possible to establish a maximum of 2 simultaneous FTP connections.
Note: A connection error is returned if a successful login request cannot be obtained. This includes invalid IP or a non-FTP response from server.
Using secure connection For NX32L devices, a secure TLS (TLS v1.2, v1.1 or 1.0) connection can be established, assuming that the matching X509 certificate is present. There are 2 ways of implementing secure connections: 1. Explicit, where the secure connection handshake is performed after the server sends the welcome message. 2. Implicit, where the secure connection handshake is performed before the server sends the welcome message. The second one is an older (non standard) method which requires a different port (the default is port 990).
With both methods, the secure connection is established before sending the User name and Password during login.
Input: Host : STRING IP address (in dotted format "aaa.bbb.ccc.ddd" or symbolic "domain.xyz".
Port : DINT (1..65535, default 21) Port to connect to on server.
iface : SINT (default 1) The network interface to use. 0 = Default network, 1 = Mobile network, 2 = LAN network, etc. (See Network) Note: For backwards compatibility the Mobile network is used as default network.
Username : STRING (default "anonymous") Username to use during login.
Password : STRING Password to use if requested by server. Note: password is only used if requested by server.
Security : SINT The required type of security used by the connection.
Returns: INT ID of new connected session.
Declaration: FUNCTION ftpConnect : INT;
Example: INCLUDE rtcu.inc |