+1 vote
by (8.6k points)
edited

For instance, I just got it when trying to upload multiple files. The problem is that the Connected property is still true, but each operation I try to perform afterwards, for instance uploading the next file in the queue, gives me the same error.

My question is: How do I handle this? Do I need to re-connect? How do I detect it? Let me know how you propose that I deal with this in my FTP client.

Applies to: Rebex FTP/SSL
by
Hi, i am getting this exception in my application while trying to upload the file to FTP. what happens to that data at that of exception.? will that lost.?

Is this been resolved.? if yes please let me know the rebex version. Thank in advance.
by (148k points)
As explained below, this exception is not sign of a bug. It indicates that the user code is trying to perform an action after a failure has occurred that has left the Ftp instance in an unusable state. If you have followed the advice below, and still get the exception below, please create a communication log (as explained below) and either post it here or mail it to support@rebex.net for analysis.

1 Answer

+1 vote
by (18.1k points)
edited
 
Best answer

This exception should only be thrown after a previous FtpException (representing the actual cause of the problem) was silently ignored.

The cause of the first exception is usually a timeout while waiting for the response of a command that the client sent to the FTP server. When a timeout or similar exception occurs, the Ftp object is most likely left in an unusable state because it has not received the response it was waiting for, and any attempt to send another command would most likely result in a similar problem. Therefore, if the application tries to issue another FTP command using an Ftp object in this state, we throw the exception you are seeing.

To handle this, detect the "bad" state of the Ftp object after catching the first FtpException that caused it - simply check whether Ftp object's State property is FtpState.Ready. If it's not, re-connect and try again.

It might also help to create a communication log using Ftp object's LogWriter property (as described at http://www.rebex.net/kb/logging/) - looking into the log, it should be easily possible to tell what is going on and what caused the bad state in the first place.

NOTE: Although reported as an error from the Rebex FTP/SSL component, the same exception can be also thrown from the SMTP, IMAP or POP3 components (parts of the Rebex Secure Mail package). A solution is the same there.

by (900 points)
any other solution for this type exception..
by (58.9k points)
Maybe, but we need to see the log of communication, so please create it using the LogWriter property as described at http://www.rebex.net/kb/logging/default.aspx

and then either post it here, or send it to support@rebex.net.
...