ComponentPro UltimateSftp

      Resume single file transfers

      Language Filter: AllSend comments on this topic to ComponentPro

      Resume file upload

      To resume a file upload, use the ResumeUploadFile method. The following code snippet demonstrates how to continue a transfer that was interrupted or canceled.

      using System;
      using System.IO;
      using ComponentPro.Net;
      
      ...
      
      // Create a new Sftp instance.
      Sftp client = new Sftp();
      
      // Connect to the SFTP server.
      client.Connect("localhost");
      
      // Authenticate.
      client.Authenticate("test", "test");
      
      // ... 
       
      // Resume uploading local file 'c:\test.dat' to '/test.dat'.
      client.ResumeUploadFile("c:\\test.dat", "/test.dat");
      
      // ... 
       
      // Disconnect.
      client.Disconnect();
      

      Resume file download

      Similarly, to resume a file download, use the ResumeDownloadFile method.

      using ComponentPro.Net;
      
      ...
      
      // Create a new class instance.
      Sftp client = new Sftp();
      
      // Connect to the SFTP server.
      client.Connect("localhost");
      
      // Authenticate.
      client.Authenticate("test", "test");
      
      // ... 
       
      // Resume downloading remote file '/test.dat' to 'c:\test.dat'
      client.ResumeDownloadFile("/test.dat", "c:\\test.dat");
      // If you also need to get the remote file length, use the following code. 
      //long remoteFileSize; 
      //client.ResumeDownloadFile("/test.dat", "c:\\test.dat", out remoteFileSize); 
      //Console.WriteLine("File size before uploading: {0}", remoteFileSize); 
       
      // ... 
       
      // Disconnect.
      client.Disconnect();