ComponentPro UltimateSftp

      Simultaneous transfer

      Language Filter: AllSend comments on this topic to ComponentPro

      Being able to execute multiple operations on a single Sftp instance simultaneously is one of the most interesting features of the SFTP protocol. The following example shows how to asynchronously upload two files at the same time.

      // Create a new class instance. 
      using (Sftp client = new Sftp())
      {
          // Connect to the SFTP server. 
          client.Connect("localhost");
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          var task1 = client.UploadFileAsync(@"c:\data\file1.dat", "/data/file1.dat");
          var task2 = client.UploadFileAsync(@"c:\data\file2.dat", "/data/file2.dat");
      
          // ...  
       
          System.Threading.Tasks.Task.WaitAll(task1, task2);
      }
      
      The Sftp class is thread-safe and you can execute multiple operations in different threads