title: download two files from SFTP site
body: <p>I'am using .NET 4.5 and I need to connect to an SFTP site and download two files to my local pc. From my reading on the internet there are no in built libraries I can use in .NET. </p>
  
  <p>Are there any reliable 3rd parties that I can use that also have simple examples?</p>
  
  <p>I have the following</p>
  
  <pre><code>username: myusername
  password: mypassword
  hostname: fts-sftp.myhost.com
  protocol: SFTP
  Port: 6621
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>I have the code below however I am getting the following error message on the "sftp.Connect()" line.</p>
  
  <p>An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll</p>
  
  <p>Additional information: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond</p>
  
  <p>Have checked the creditenals that have been supplied to me to make sure I have no typo's.</p>
  
  <pre><code>using Renci.SshNet;
  using Renci.SshNet.Common;
  using Renci.SshNet.Sftp;
  
  namespace SftpExample2
  {
      class Program
      {
          static void Main(string[] args)
          {
  
              string host = "fts-sftp.myaddress.com";
              string password = "mypassword";
              string username = "myusername";
              string remoteDirectory = ".";
              int port = 6671;
  
              using (SftpClient sftp = new SftpClient(host, port, username, password))
              {
                  sftp.Connect();
  
                  var files = sftp.ListDirectory(remoteDirectory);
  
                  foreach (var file in files)
                      Console.WriteLine(file.FullName);
  
                  sftp.Disconnect();
               };
  
          }
       }
   }
  </code></pre>