(AutoIt) Determine if Connected and Logged On
The IsConnected property indicates whether or not the FTP component has a valid TCP/IP connection (and is logged on) to the FTP server.
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oFtp = ObjCreate("Chilkat.Ftp2")
$oFtp.Hostname = "ftp.example.com"
$oFtp.Username = "mylogin"
$oFtp.Password = "mypassword"
; Connect and login to the FTP server.
Local $bSuccess = $oFtp.Connect()
If ($bSuccess <> True) Then
ConsoleWrite($oFtp.LastErrorText & @CRLF)
Exit
EndIf
; ...
; At any point in an FTP session, the IsConnected property
; can be checked to determine if the component has remained
; connected to the FTP server.
If ($oFtp.IsConnected = True) Then
ConsoleWrite("Connected!" & @CRLF)
Else
ConsoleWrite("Not connected!" & @CRLF)
EndIf
; ...
$bSuccess = $oFtp.Disconnect()
|