This project is read-only.

Stale data socket error

Apr 28, 2016 at 8:18 PM
I am attempting to automate the download of an unknown number of files from a remote server. There are typically one - five files daily. The remote server is set up so that once you login regardless of if you download the files or not, they are cleared from the directory on logout, or resetting the connection. Here in lies my problem. I can download the first file without any problems. I have verified that the second file can be downloaded if it is the only file, so it is not a corrupt file issue. However, when I attempt to download the second file in the list that was retrieved from the server I get an error:
Time to activate encryption: 0h 0m 0s, Total Seconds: 0.454.
Disposing FtpSocketStream...
There is stale data on the socket, maybe our connection timed out. Re-connecting.
It then resets the connection, therefor my second file is wiped out. I have asked about them leaving the files for an extended period and received a big NO.

I am writing this in C# and using the System.Net.FtpClient utility The connection is PASV using implicit encryption mode. I have attempted to use the FtpClient utilities StateDataCheck = false setting and then I get a Malformed PASV command exception.

Any ideas??? I can post more code if necessary. Any help would be greatly appreciated.
Apr 28, 2016 at 10:01 PM
Try disabling thread safe data connections. Based on what you described it sounds like it would cause the directory to be cleared; it creates a separate control connection to the server and I don't think you want that.
Apr 29, 2016 at 1:24 PM
I had actually had it disabled, so I re-enabled it and it is working now. Thank you thank you thank you. :)