title: "Socket read operation has timed out" exception with SSH.NET when connecting to FTP port 21
body: <p>I got the exception below when the client tries to connect to FTP server:</p>
  
  <blockquote>
    <p>Socket read operation has timed out after 30000 milliseconds.     </p>
    
    <p>Source = "Renci.SshNet" </p>
    
    <p>at Renci.SshNet.Abstractions.SocketAbstraction.Read(Socket socket, Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
    at Renci.SshNet.Session.SocketReadLine(TimeSpan timeout)
    at Renci.SshNet.Session.Connect()
    at Renci.SshNet.BaseClient.Connect()
    at SftpClient.ReadAllBytesAsync() in C:\SftpClient\SftpClient.cs:line 42</p>
  </blockquote>
  
  <p>Code below:</p>
  
  <pre><code>using (Renci.SshNet.SftpClient sftp = new Renci.SshNet.SftpClient(server,
                                                      21,
                                                      Username,
                                                      Password))                      
      sftp.Connect();  //exception here
      content = sftp.ReadAllBytes(FilePath);    
      sftp.Disconnect();                      
  }
  </code></pre>
  
  <p>SSH.NET version: 2016.1.0</p>
  
  <p>However, it connects via telnet like below via command prompt:</p>
  
  <pre class="lang-none prettyprint-override"><code>telnet server_ip_address 21
  220 (SFTPPlus_3.15.0) Welcome to the FTP/FTPS Service.
  </code></pre>
  
  <p>A staff on server side sends me public certificates, which I installed on my Windows 10. </p>
  
  <p>Any idea?</p>
  
  <hr>
  
  <p><strong>Solution</strong>:</p>
  
  <p>Use this one: <a href="http://github.com/robinrodricks/FluentFTP" rel="nofollow noreferrer">github.com/robinrodricks/FluentFTP</a></p>