|
Rebex FTP doesn't seem to be able to detect when the FTP server is no longer connected. A couple of days ago I downloaded Rebex.Net.Ftp version 3.0.3854.0 for use with Visual Studio 2008 VB. Using FileZilla Server 0.9.37, I connect to the FTP server thusly:
I can successfully traverse the directory structure and list directory contents. I wanted to test my ability to detect when the FTP connection times out and is no longer connected. I attached the following code to a button. Clicking on the button before connecting results in "Not Connected" being displayed. Clicking on the button after connecting results in "Connected" being displayed. However, if I:
Any idea why the .GetConnectionState.Connected is not detecting that things are no longer connected? I don't want to use try/catch to determine when I don't have a connection, I want to use GetConnectionState.Connected. Thanks, Jim
|
|
The only way to determine whether the connection is still active is to send a command over it - if the connection has already been lost, it won't be possible to transmit the command to the server and the connection will become "Not Connected" as soon as an error occurs. However, sending a command to the FTP server and waiting for failure or response is not as simple as checking the current state of an TCP socket (which is what `GetConnectionState does) and may take many seconds to complete. A more reliable way to detect whether the connection is still active would be to call We might add an overload for GetConnectionState in one of the future releases that would do this automatically, but its behavior would be equivalent to what you get by calling |