I am constantly getting this error:
ERROR [FTPClient] 30 Jun 2008 18:42:37.875 : Caught exception : System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at EnterpriseDT.Net.Ftp.FTPClient.ReadChunk(Stream input, Byte[] chunk, Int32 chunksize)
at EnterpriseDT.Net.Ftp.FTPClient.a(String A_0, String A_1)
CAUSED BY:
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
DEBUG [FTPControlSocket] 30 Jun 2008 18:42:37.890 : Setting socket timeout=500
DEBUG [FTPControlSocket] 30 Jun 2008 18:42:38.921 : Setting socket timeout=120000
DEBUG [AsyncProcessor] 30 Jun 2008 18:42:38.921 : Stopping FTP task processor.
DEBUG [AsyncProcessor] 30 Jun 2008 18:42:38.921 : FTP task processor stopped.
A first chance exception of type 'System.IO.IOException' occurred in edtFTPnetPRO.dll
A first chance exception of type 'EnterpriseDT.Net.Ftp.FTPException' occurred in edtFTPnetPRO.dll
This happens directly after a downloaded file completes. Sometimes this causes my files to disappear. I also have redundancy built into my code:
int retryCount = 0;
int maxRetries = 10;
bool succeeded = false;
dConnection.DeleteOnFailure = false;
do
{
try
{
dConnection.Connect();
if (retryCount > 0)
{
dConnection.ResumeTransfer();
}
dConnection.DownloadFile(Path.Combine(localPath, fileName), remoteFile[partNumber]);
succeeded = true;
}
catch (Exception)
{
retryCount++;
// should log exception here
}
finally
{
try
{
dConnection.Close();
}
catch (Exception)
{
// should log exception here
}
}
} while (!succeeded && retryCount <= maxRetries);