Reads and returns control connection data, if available.

      Syntax

      public FtpResponse Flush(
         int timeout
      )

      Parameters

      timeout
      The length of time (in milliseconds) to wait for data to be received.

      Return Value

      FtpResponse if data was read or null reference if no data available.

      Remarks

      This method can either be used to read messages from the FTP server that are not responses to any commands, or to set the State property back to the Ready state if it is not Ready state after aborting a file transfer with the Cancel method.

      If the State of the Ftp object is Reading, Sending or Processing and no data is available within the specified time limit, it returns with a null reference. If data is available, it is read and returned. If the object is in any other state, an exception is thrown.

      Examples

      Shows how to use the Flush method to read and return control connection data, if available.

      using System;
      using System.Collections.Generic;
      using System.Text;
      using ComponentPro.Net;
      using ComponentPro.IO;
      
      ...
      
      // Create a new Ftp instance.
      Ftp client = new Ftp();
      
      // Connect to the FTP server.
      client.Connect("demo.componentpro.com");
      
      // Authenticate.
      client.Authenticate("test", "test");
      
      // ... 
       
      // Suppose the client.State is not Idle and we need th get the last response from the server. 
      if (client.State != RemoteFileSystemState.Ready)
      {
          FtpResponse response = client.Flush(3000); // Time out in 3 seconds. 
       
          if (response != null)
              Console.WriteLine(response.RawResponse);
      }
      
      // Disconnect.
      client.Disconnect();

      Framework

      .NET Compact Framework.NET Compact Framework

      Supported version: 2.0, 3.5, and 3.9
      Assembly: ComponentPro.Ftp.CF (in ComponentPro.Ftp.CF.dll)

      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.Ftp (in ComponentPro.Ftp.dll)

      Portable Class Library for Windows Phone 8.1 and Windows 8.1 Store AppsPortable Class Library for Windows Phone 8.1 and Windows 8.1 Store Apps

      Supported version: 4.6.x and later
      Assembly: ComponentPro.Ftp.WinPcl (in ComponentPro.Ftp.WinPcl.dll)

      Universal Windows Platform (includes Windows 10 Mobile, Windows 10 Store Apps and Windows 10 IoT)Universal Windows Platform (includes Windows 10 Mobile, Windows 10 Store Apps and Windows 10 IoT)

      Supported version: 4.6.x and later
      Assembly: ComponentPro.Ftp.Uwp (in ComponentPro.Ftp.Uwp.dll)

      Xamarin AndroidXamarin Android

      Supported version: 2.3 and later
      Assembly: ComponentPro.Ftp.Android (in ComponentPro.Ftp.Android.dll)

      Xamarin MacXamarin Mac

      Supported version: 2.0.x and later
      Assembly: ComponentPro.Ftp.Mac (in ComponentPro.Ftp.Mac.dll)

      Xamarin iOSXamarin iOS

      Supported version: 5.1.x and later
      Assembly: ComponentPro.Ftp.iOS (in ComponentPro.Ftp.iOS.dll)

      See Also