Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.1k views
in .NET FTP by
I have a problem with Put() which occurs more on large files than small ones, the example below was for a 24MB transfer.

My file transfers seem to complete on the ftp server as per the server log trace below (FileZilla server):

(000006) 28/01/2006 20:39:50 - gdl (81.101.133.197)> PASV
(000006) 28/01/2006 20:39:50 - gdl (81.101.133.197)> 227 Entering Passive Mode (194,164,218,228,195,84)
(000006) 28/01/2006 20:39:50 - gdl (81.101.133.197)> STOR Claim Documents.zip.25504099_1C14B45FF19C46EE40C953FE3F154AFD
(000006) 28/01/2006 20:39:50 - gdl (81.101.133.197)> 150 Connection accepted
(000006) 28/01/2006 20:57:39 - gdl (81.101.133.197)> 226 Transfer OK
(000006) 28/01/2006 20:57:39 - gdl (81.101.133.197)> disconnected.

But the call to ValidateTransfer within the ftp client Put method never sees the response code, ultimately generating the following exception: "Unable to read data from the transport connection."

The end part of the ftp client debug trace is below:
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 28 Jan 2006 20:36:58.954 : ---> PASV
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 28 Jan 2006 20:36:58.984 : 227 Entering Passive Mode (194,164,218,228,195,84)
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 28 Jan 2006 20:36:59.014 : ---> STOR Claim Documents.zip.25504099_1C14B45FF19C46EE40C953FE3F154AFD
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 28 Jan 2006 20:36:59.044 : 150 Connection accepted
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 28 Jan 2006 20:54:48.700 : Transferred 25484282 bytes to remote host

I have tried various timeouts from 60s to infinity i.e timeout values of 60000 to 0 (which causes Put never to return).

I have also tried 2 ftp servers: FileZilla and Ocean - both exhibit the same behaviour so I believe the problem is in the client rather than the server.

Can anybody help?

2 Answers

0 votes
by
Don't have much of a solution, but I have definately found the same problem. Does not appear to me to be file size related - but speed of connection related. The ftp we are doing works perfectly fine on the local lan, but fails every time outside it, regardless of location.

If I put a breakpoint on the ValidateTransfer command, and let it pause for a second or two before performing the call, it works fine.

So, I tried a simple :
System.Threading.Thread.Sleep(1000);

before the validatetransfer and that works fine too.

It seems that the final reply does not come through completely before the readReply() call is made inside validateTransfer(), which causes the exception in the lower level read code.

I don't know enough about sockets to take it much further though, so I might just stick with a configurable sleep value for now.

Hope this helps find the problem.

Mike.
0 votes
by
Now I feel like an idiot

The FTPClient.timeout parameter is in milliseconds. I was setting it to "20". No wonder it's timing out. Not sure if that is the same problem you are having - and the doco does not give units for the timeout value - but I would suspect you have the same problem.

I changed the timeout setting to 20000, and upload and download work like a charm.

Categories

...