Hi, i’m having some problems trying to catch an error during a file transfer, i need to detect the error from a windows service (.NET) while it’s getting a file from another pc with ReceiveFile() and the client is disconnected or goes down.
I need to know how to catch the exact moment when the disconnection error occurs, in order to put a flag in a SQL Server table and send a message, i don’t want to restart the transference
So far, i’ve been using some event handlers such as : StateChanged, Disconnected, ReplyReceived, but no one raises an event when the other pc goes down or when it’s unplugged, and no exception is raised either
Thanks a lot for the help !!!!
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by MXDeveloper (had 2398 views)
There is no notion of ping and ack with the FTP protocol over TCP. That’s why the only true way to detect a disconnection is to decide for yourself how long of an idle state can you tolerate before disconnecting.
That’s why I suggest you set the Timeout property to that value (the default is 30 seconds). ReceiveFile should throw a timeout exception when it hasn’t received a packet for that long.
Then, you can log the error, and also check if the command channel is still connected by looking at the State (or Connected) property.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Martin (had 3254 views)