Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
12.1k views
in .NET FTP by (162k points)
A user writes:

9 Answers

0 votes
by (162k points)
Most likely the server is timing out the connection. You may need to increase the server timeout. Inspect the server logs if you have access to confirm this.
0 votes
by (260 points)
Bruce,

Thanks for your reply. I have tried this with three servers, they have all displayed the same behavior as well. One of the servers I have administrative control over and I'll post the relevant log info below. I also set the timeout to 0 on this ftp server (0=disabled), so that should not be an issue. As far as I can tell the library isn't picking up on the 226 Transfer Successful with large files.

FTP server log file (server does reply with 226):
(000024) 4/21/2008 8:10:58 AM - masher (24.210.219.)> PORT 24,210,219,99,234,129
(000024) 4/21/2008 8:10:58 AM - masher (24.210.219.)> 200 Port command successful
(000024) 4/21/2008 8:10:58 AM - masher (24.210.219.)> STOR CTF-Haco.ut3.uz3
(000024) 4/21/2008 8:10:58 AM - masher (24.210.219.)> 150 Opening data channel for file transfer.
(000024) 4/21/2008 8:18:40 AM - masher (24.210.219.)> 226 Transfer OK
(000024) 4/21/2008 8:19:22 AM - masher (24.210.219.)> disconnected.
--Disconnect and reconnect to resume the transfer
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> 200 Port command successful
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> SIZE CTF-Haco.ut3.uz3
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> 213 26799409
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> REST 26799409
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> 350 Rest supported. Restarting at 26799409
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> STOR CTF-Haco.ut3.uz3
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> 150 Opening data channel for file transfer.
(000025) 4/21/2008 8:20:41 AM - masher (24.210.219.)> 226 Transfer OK

edtFTPnet debug log file:
DEBUG [FTPControlSocket] 21 Apr 2008 09:11:00.469 : ---> PORT 192,168,0,64,5,74
DEBUG [FTPControlSocket] 21 Apr 2008 09:11:00.500 : 200 Port command successful
DEBUG [FTPControlSocket] 21 Apr 2008 09:11:00.500 : ---> STOR CTF-Haco.ut3.uz3
DEBUG [FTPControlSocket] 21 Apr 2008 09:11:00.531 : 150 Opening data channel for file transfer.
DEBUG [FTPActiveDataSocket] 21 Apr 2008 09:11:00.563 : AcceptConnection() succeeded
ALL [FTPConnection] 21 Apr 2008 09:11:05.984 : Invoking delegate EnterpriseDT.Net.Ftp.BytesTransferredHandler -> UnrealRSC.UnrealRSC.gsFtp_BytesTransferred
...BytesTransferred event stuff removed
DEBUG [FTPClient] 21 Apr 2008 09:18:42.312 : Closing source stream
ALL [FTPConnection] 21 Apr 2008 09:18:42.390 : Invoking delegate EnterpriseDT.Net.Ftp.BytesTransferredHandler -> UnrealRSC.UnrealRSC.gsFtp_BytesTransferred
ALL [FTPConnection] 21 Apr 2008 09:18:42.390 : No GUI control
ALL [FTPConnection] 21 Apr 2008 09:18:42.390 : Invoking delegate dynamically
ALL [FTPConnection] 21 Apr 2008 09:18:42.390 : Dynamic delegate invocation complete
DEBUG [FTPClient] 21 Apr 2008 09:18:42.390 : Transferred 26799409 bytes to remote host
ERROR [FTPClient] 21 Apr 2008 09:20:43.104 : IOException in Put(string,string,bool) : 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.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at EnterpriseDT.Net.Ftp.FTPControlSocket.ReadReply()
at EnterpriseDT.Net.Ftp.FTPClient.ValidateTransfer()
at EnterpriseDT.Net.Ftp.FTPClient.Put(String localPath, String remoteFile, Boolean append)
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)
--REconnect to resume transfer
DEBUG [HostNameResolver] 21 Apr 2008 09:20:43.307 : woot resolved to 67.106.81.48
DEBUG [FTPClient] 21 Apr 2008 09:20:43.307 : Connecting to 67.106.81.48:21
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.386 : 220-FileZilla Server version 0.9.24 beta
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.542 : 220-written by Tim Kosse (Tim.Kosse@gmx.de)
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.542 : 220 Please visit http://sourceforge.net/projects/filezilla/
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.542 : ---> USER masher
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.573 : 331 Password required for masher
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.573 : ---> PASS ********
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.589 : 230 Logged on
DEBUG [FTPConnection] 21 Apr 2008 09:20:43.589 : Successfully logged in
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.589 : ---> TYPE I
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.620 : 200 Type set to I
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.620 : ---> CWD /redirect
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.636 : 250 CWD successful. "/redirect" is current directory.
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.636 : ---> PWD
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.667 : 257 "/redirect" is current directory.
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.667 : ---> TYPE I
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.698 : 200 Type set to I
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.698 : ---> CWD /redirect
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.714 : 250 CWD successful. "/redirect" is current directory.
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.714 : ---> PWD
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.745 : 257 "/redirect" is current directory.
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.745 : NewActiveDataSocket(0)
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.745 : ---> PORT 192,168,0,64,5,100
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.761 : 200 Port command successful
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.761 : ---> SIZE CTF-Haco.ut3.uz3
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.792 : 213 26799409
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.792 : ---> REST 26799409
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.808 : 350 Rest supported. Restarting at 26799409
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.808 : ---> STOR CTF-Haco.ut3.uz3
DEBUG [FTPControlSocket] 21 Apr 2008 09:20:43.839 : 150 Opening data channel for file transfer.
DEBUG [FTPActiveDataSocket] 21 Apr 2008 09:20:43.870 : AcceptConnection() succeeded
DEBUG [FTPClient] 21 Apr 2008 09:20:43.870 : Closing source stream
ALL [FTPConnection] 21 Apr 2008 09:20:43.870 : Invoking delegate EnterpriseDT.Net.Ftp.BytesTransferredHandler -> UnrealRSC.UnrealRSC.gsFtp_BytesTransferred
ALL [FTPConnection] 21 Apr 2008 09:20:43.870 : No GUI control
ALL [FTPConnection] 21 Apr 2008 09:20:43.870 : Invoking delegate dynamically
ALL [FTPConnection] 21 Apr 2008 09:20:43.870 : Dynamic delegate invocation complete
DEBUG [FTPClient] 21 Ap
0 votes
by (162k points)
The client could be timing out the connection - have you set the timeout (in millis) higher than the time for the transfer?
0 votes
by (260 points)
Thanks for your help. I was optimistic this would fix it, and as suggested I set the timeout as so:

ftp.Timeout = 3600000;


The largest file I have takes around 15 mins to upload, so I set the timeout to an hour. The upload finishes and hangs, I'll assume it'll hang until the timeout is reached as it has. I tried my own ftp server and another with the higher timeout setting to no avail--it's still hanging.

I think I've ruled out the following as issues
FTP Server Timeout
edtFTPnet Timeout Setting
Not an issue with my FTP Server as I've tried and got the same results with different FTP server programs/platforms
Not specific to 1.2.6, tested back to 1.2.3 and they all hang at the end of a successfull upload until the timeout period is reached with large files

edtFTPnet doesn't seem to 'process' the reply from the server indicating the upload was successfull. Do you have any other ideas?

Thanks again for your help,
Mash
0 votes
by (162k points)
The client is failing on ReadReply() which is where the server reply is read - the server is not sending the expected reply at the end of the transfer. The client is certainly trying to read it.

The server logs may tell you something. It is also worth trying the Filezilla client (or another client) to see if you get a similar problem.
0 votes
by (260 points)
Yep, you are correct. I even went as far as capturing network traffic....

Is this typical for ftp servers or should this be considred a bug?

Thanks again for your help and excellent product. :)
0 votes
by (162k points)
Thanks. It sounds like a bug in the server, but one that is quite common.
0 votes
by (260 points)
Just to follow up, I believe the server closes the control connection.

What I've done to get around this is to catch the error and disconnect/reconnect. If the file size on the ftp server matches then move on in the program; else issue a resume and restart the transfer. Hope that may help someone who may be experiencing similar issues.
0 votes
by (140 points)
Hey Masher

Can you post your connect/disconnect code on excpetion? I am having the same issue.

Thanks,
Lorick

Categories

...