(Tcl) Use Explicit FTP over TLS
Demonstrates how to connect to an FTP server using explicit FTP over TLS.
load ./chilkat.dll
# 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.your-ftp-server.com"
CkFtp2_put_Username $ftp "ftpAccountLogin"
CkFtp2_put_Password $ftp "ftpAccountPassword"
# Indicate that the "AUTH TLS" command should be use to convert the connection to TLS
# after the initial TCP connection to port 21 is established.
CkFtp2_put_AuthTls $ftp 1
# Connect and convert the connection to TLS automatically.
set success [CkFtp2_ConnectOnly $ftp]
if {$success != 1} then {
puts [CkFtp2_lastErrorText $ftp]
delete_CkFtp2 $ftp
exit
}
set success [CkFtp2_LoginAfterConnectOnly $ftp]
if {$success != 1} then {
puts [CkFtp2_lastErrorText $ftp]
delete_CkFtp2 $ftp
exit
}
puts "TLS connection established and successfully authenticated."
delete_CkFtp2 $ftp
|