ComponentPro UltimateSftp

      Make a trace log

      Language Filter: AllSend comments on this topic to ComponentPro

      When you want to log commands sent to the server and the corresponding responses, use the following useful events:

      Event name Description
      CommandResponse Occurs when a command is sent to the server or a response is received from the server.
      Progress Occurs when data is sent or received. It can be used by a GUI application to display a progress bar.

      The example below shows you how to handle the CommandResponse event to log commands sent to the server and responses:

      using System;
      using ComponentPro.Net;
      
      ...
      
      [STAThread]
      static void Main()
      {
          // Create a new class instance. 
          Scp client = new Scp();
      
          client.CommandResponse += client_CommandResponse;
      
          // Connect to the SCP server. 
          client.Connect("localhost");
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // ... 
       
          // Do something here 
       
          // ... 
       
          // Disconnect. 
          client.Disconnect();
      }
      
      static void client_CommandResponse(object sender, CommandResponseEventArgs e)
      {
          if (e.Command != null)
              Console.WriteLine("CMD>       " + e.Command);
          else 
              Console.WriteLine("RESPONSE>  " + e.Response);
      }