ComponentPro UltimateSftp

      Determine local PC and server time difference

      Language Filter: AllSend comments on this topic to ComponentPro

      To determine the time difference between the client and the SFTP server, call the GetServerTimeDifference method. We will take advantage of this method with the following example:

      using System;
      using ComponentPro.Net;
      
      ...
      
      // Create a new class instance.
      Sftp client = new Sftp();
      
      // Connect to the SFTP server.
      client.Connect("myserver");
      
      // Authenticate.
      client.Authenticate("userName", "password");
      
      // ... 
       
      // Get the time difference between the server and the client.
      TimeSpan ts = client.GetServerTimeDifference();
      
      Console.WriteLine("Time difference: " + ts.ToString());
      
      // ... 
       
      // Disconnect.
      client.Disconnect();