ISCONNECTED Check if the connection with the FTP server is alive
Syntax:
ISCONNECTED()
Remarks:
This command sends an empty request (also called NOP in the FTP protocol specification) to the FTP server ans waits for the response.
As this command does not have any parameters it can be used without parenthesis.
Return value:
If no response is received in 45 seconds or if the connection is already broken it returns “FALSE”, otherwise it returns “TRUE”.
See also:
SETTIMEOUT
OPENHOST
Error Handling
Command history:
This command was added in ScriptFTP version 3.3.
Examples:
# Check if the connection is alive $result=ISCONNECTED IF($result) PRINT("Connection is alive") ELSE PRINT("Connection with the FTP server is broken") END IF #This is a label, it marks a position in the script. :start # Connect to FTP server OPENHOST("ftp.myhost.com","myusername","mypassword") # Download some zip files $result=GETFILE("*.zip") # If GETFILE got an error and the connection is broken retry IF($result!="OK" AND ISCONNECTED()=="FALSE") GOTO :start END IF IF($result!="OK" AND ISCONNECTED()=="TRUE") PRINT("Error downloading zip files. The error is not related to the connection. Stopping the script.") STOP END IF # If ScriptFTP reaches this point of the script # means that the file download were successful. Close the connection. CLOSEHOST