0 votes
by (130 points)
edited

I use a trial version. I am facing an issue when I call the _ftp.ChangeDirectory() method on remote server. I thought the passive mode but this does not solve the problem. I note that this error is not systematic, it sometimes occurs.

Here is the log:

07/05/2011 - 10:29:41.112 [1] ... An error orccured on ChangeDirectory. Error : An established connection was aborted by the software in your host machine. -
   at Rebex.Net.Ftp.BQDrolZ(String , String )
   at Rebex.Net.Ftp.CnNcvYZ(String )
   at Rebex.Net.Ftp.ChangeDirectory(String remotePath)

.....

10:43:52.794 Error Info: Rebex.Net.FtpException: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at Rebex.Net.ProxySocket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at wWGvS.AgXIfM.ByklbC(Byte[] )
   at Rebex.Net.Ftp.BQDrolZ(String , String )
   --- End of inner exception stack trace ---
   at Rebex.Net.Ftp.BQDrolZ(String , String )
   at Rebex.Net.Ftp.CnNcvYZ(String )
10:43:52.794 Error Info: System.InvalidOperationException: Not connected to the server.
   at Rebex.Net.Ftp.cOUusW()
   at Rebex.Net.Ftp.GetList(String arguments)93

93

Applies to: Rebex FTP/SSL

1 Answer

+1 vote
by (147k points)
edited

This looks like the error occurred while trying to send the CWD (ChangeDirectory) command to the FTP server. The error message seems to indicate that the connection was disconnected locally, but unfortunately these socket exceptions are often misleading. Perhaps you left the connection idle for several minutes and the server disconnected you? Or does this happen out-of suddent? A log snippet that includes few commands preceding the failed one might help shed some light on this.

(Active/passive mode did make any difference in case of GetList because the error occurred before the data connection was established.)

by (130 points)
edited

My Application Monitors folders every XX minutes. To deal with problem you mentioned "Perhaps you left the connection idle for several minutes and the server disconnected you?" Each time I create a new instance of FTP. I initialize it. It seems to work now.

by (147k points)
edited

That looks like the best solution. An alternative would be to call KeepAlive method every minute or so, but that would be more complicted and some FTP servers are even known to ignore these keep-alive attempts.

...