Xbase++
Xbase++
Determine if Connected and Logged On
See more FTP Examples
The IsConnected property indicates whether or not the FTP component has a valid TCP/IP connection (and is logged on) to the FTP server.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oFtp
nSuccess := 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oFtp := CreateObject("Chilkat.Ftp2")
oFtp:Hostname := "ftp.example.com"
oFtp:Username := "mylogin"
oFtp:Password := "mypassword"
// Connect and login to the FTP server.
nSuccess := oFtp:Connect()
IF (nSuccess != 1)
? oFtp:LastErrorText
oFtp:destroy()
RETURN
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 == 1)
? "Connected!"
ELSE
? "Not connected!"
ENDIF
// ...
nSuccess := oFtp:Disconnect()
oFtp:destroy()