ftpConnected (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

2.10 / 1.00.00


This function will test whether a connection to the FTP server has been established.

The connection state information is based on an expected response from the FTP server and does therefore not reflect the socket connection establishment itself.

 

 

Input:

ID : INT

The ID returned from ftpConnect.

 

Returns: BOOL

True if connected to server, false if not.

 

Declaration:

FUNCTION ftpConnected : BOOL;
VAR_INPUT
  ID     : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  open : BOOL;
  host : STRING := "ftp.domain.com";
  usr   : STRING := "ftpuser";
  pwd   : STRING := "user pwd";
 
  id   : INT;
END_VAR;
 
  gsmPower(power := ON);
  gprsOpen();
 
BEGIN
 open := (ftpOpen() = 0);
IF open THEN
    id := ftpConnect(host := host, username := usr, password := pwd);
    IF ftpConnected(id := id) THEN
    .
    ...
    END_IF;
    ftpDisconnect(id := id);
END_IF;
ftpClose();
END;
END_PROGRAM;