FluentFTP - Getting error while connecting “Timed out trying to read data from the socket stream!”

后端 未结 2 1030
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-13 09:43

Getting

Timed out trying to read data from the socket stream!

when connecting to FTP using FluentFTP.

Below is the sourc

相关标签:
2条回答
  • 2021-01-13 09:50

    In FileZilla, you are connecting to implicit FTPS port 990.

    If you also use this port in C#, you cannot use FtpEncryptionMode.Explicit.

    Use FtpEncryptionMode.Implicit.

    Though you better connect to port 21 and keep using FtpEncryptionMode.Explicit, if that port is available.

    0 讨论(0)
  • 2021-01-13 10:02

    The following code is all you need to get FluentFtp (at least nuget (1.0.5824.34026) to use secure connection .

            FtpClient fclient = new FtpClient(hostname, username, password); // or set Host & Credentials
    
            fclient.EncryptionMode = FtpEncryptionMode.Implicit;  
            fclient.SslProtocols = SslProtocols.Tls12;
    
            //client.Port = 990;  // Not required - probably gives you exceptions if you try to set it. 
    
            fclient.Connect();
            fclient.UploadFile(@"C:\tmp\a.txt", "big.txt");
    

    0 讨论(0)
提交回复
热议问题