public FtpResponse Flush( int timeout )
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.
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();