Rust
Rust
Use Explicit FTP over TLS
See more FTP Examples
Demonstrates how to connect to an FTP server using explicit FTP over TLS.Chilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let ftp = chilkat::Ftp2::new();
ftp.set_hostname("ftp.your-ftp-server.com");
ftp.set_username("ftpAccountLogin");
ftp.set_password("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.
ftp.set_auth_tls(true);
// Connect and convert the connection to TLS automatically.
if ftp.connect_only().is_err() {
println!("{}", ftp.last_error_text());
return;
}
if ftp.login_after_connect_only().is_err() {
println!("{}", ftp.last_error_text());
return;
}
println!("TLS connection established and successfully authenticated.");