ComponentPro UltimateFtp

      Automatic reconnect and resume transfer on failure

      Language Filter: AllSend comments on this topic to ComponentPro

      Auto reconnect

      When the ReconnectionMaxRetries property is set to a value greater than 0, if an operation is interrupted due to a broken connection, the component automatically determines whether it should reconnect to the server.

      // Create a new instance of the Ftp class. 
      using (Ftp client = new Ftp())
      {
          // Connect to the server. 
          client.Connect(serverName);
      
          // Authenticate the user 
          client.Authenticate(userName, password);
      
          // Retry 2 times before reporting error. 
          client.ReconnectionMaxRetries = 2;
      
          // If any error occurs while doing this operation, the client will check if reconnection is required. 
          // It will retry 2 time before throwing error. 
          FileInfoCollection list = client.ListDirectory("/data");
      
          // ...
      }
      

      Auto resume

      If a file transfer is in progress, the component will automatically resume transfer when the connection is re-established.

      // Create a new instance of the Ftp class. 
      using (Ftp client = new Ftp())
      {
          // Connect to the server. 
          client.Connect(serverName);
      
          // Authenticate the user 
          client.Authenticate(userName, password);
      
          // Retry 2 times before reporting error. 
          client.ReconnectionMaxRetries = 2;
      
          // If any error occurs while downloading a remote file, the client will reconnect to the server if the connection is broken and resume the transfer automatically. 
          // It will retry 2 time before throwing error. 
          client.DownloadFile("/remote file.dat", @"c:\data\file.dat");
      
          // ...
      }