Sample code for 30+ languages & platforms
Tcl

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 Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set ftp [new_CkFtp2]

CkFtp2_put_Hostname $ftp "ftp.example.com"
CkFtp2_put_Username $ftp "mylogin"
CkFtp2_put_Password $ftp "mypassword"

# Connect and login to the FTP server.
set success [CkFtp2_Connect $ftp]
if {$success != 1} then {
    puts [CkFtp2_lastErrorText $ftp]
    delete_CkFtp2 $ftp
    exit
}

# ...

# 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 {[CkFtp2_get_IsConnected $ftp] == 1} then {
    puts "Connected!"
} else {
    puts "Not connected!"
}

# ...

set success [CkFtp2_Disconnect $ftp]

delete_CkFtp2 $ftp