Setting FtpProxyType through FileTransferClient

0 votes
asked Feb 19 by rexh (150 points)

FileTransferClient has the Proxy property of type ProxyType instead of FtpProxyType. Does that mean there is no way to set proxy type to FtpSite, FtpUser, etc. through the FileTransferClient?

1 Answer

0 votes
answered Feb 19 by stepantalalayev (3,940 points)

Hello,

there is a way to set FtpProxyType. The FtpProxy class is actually a child of Proxy class so you can set it directly the following way:

    var proxy = new FtpProxy();
    proxy.Host = "host";
    proxy.ProxyType = FtpProxyType.FtpUser;
    fileTransferClient.Proxy = proxy;

Or the shorter way:

fileTransferClient.Proxy = new FtpProxy(FtpProxyType.None, "host", 987654, "username");
commented Feb 26 by rexh (150 points)
I think I will ask it here too. How about the AbortTimeout property. I don't see it available through the FileTransferClient.
commented Feb 26 by Lukas Matyska (43,090 points)
This is special property related only to FTP protocol. It doesn't have any meaning in SFTP protocol. This is the reason why the property is not on common FileTransferClient object.

You can set specific properties like this:

    var client = new FileTransferClient();
    client.Connect("host", FileTransferMode.Ftp);

    var ftp = client.Inner as Ftp;
    if (ftp != null)
    {
        ftp.AbortTimeout = 5000;
    }
commented Feb 26 by rexh (150 points)
thank you very much!
...