Zig
Zig
FTPS / Implicit SSL
See more FTP Examples
Demonstrates how to connect using implicit SSL on port 990. The FTP component connects using SSL on port 990, which is the de-facto standard FTP SSL port. Not all FTP servers support implicit SSL. An alternative is to use AUTH SSL (also called AUTH TLS).Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
var success: bool = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const ftp = try chilkat.Ftp2.init();
defer ftp.deinit();
// If this example does not work, try using passive mode
// by setting this to true.
ftp.setPassive(false);
ftp.setHostname("ftp.something.com");
ftp.setUsername("test");
ftp.setPassword("test");
ftp.setPort(990);
// We don't want AUTH SSL:
ftp.setAuthTls(false);
// We want Implicit SSL:
ftp.setSsl(true);
// Connect and login to the FTP server.
success = if (ftp.connect()) true else |_| false;
if (!success) {
std.debug.print("{s}\n", .{try ftp.getLastErrorText(alloc)});
return;
} else {
// LastErrorText contains information even when
// successful. This allows you to visually verify
// that the secure connection actually occurred.
std.debug.print("{s}\n", .{try ftp.getLastErrorText(alloc)});
}
std.debug.print("FTPS Channel Established!\n", .{});
// Do whatever you're doing to do ...
// upload files, download files, etc...
success = if (ftp.disconnect()) true else |_| false;
}