Сделайте так, чтобы это работало также с AlexFTPS , вам просто нужно добавить StartKeepAlive
.
try
{
string fileName = Path.GetFileName(this.UrlString);
Uri uri = new Uri(this.UrlString);
string descFilePath = Path.Combine(this.DestDir, fileName);
using (FTPSClient client = new FTPSClient())
{
// Connect to the server, with mandatory SSL/TLS
// encryption during authentication and
// optional encryption on the data channel
// (directory lists, file transfers)
client.Connect(uri.Host,
new NetworkCredential("anonymous",
"name@email.com"),
ESSLSupportMode.ClearText
);
client.StartKeepAlive();
// Download a file
client.GetFile(uri.PathAndQuery, descFilePath);
client.StopKeepAlive();
client.Close();
}
}
catch (Exception ex)
{
throw new Exception("Failed to download", ex);
}