Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.5k views
in .NET FTP by (320 points)
Hi everyone.
I am working on a .NET application and trying to use EDT FTP .Net client.
I use the same executables and input parameters, but sometimes I get an error condition.
It looks like the answers I get are somehow scrambled or delayed.
Giving a look at the FTP server log files, it looks like everything is ok, no errors at all.
I post here some examples taken from the log file of the EDT client.
Can anyone give help?
Thanks.

EDT FTP .Net client debug lines when the application is correctly working:

DEBUG [FTPConnection] 3 dic 2013 17:53:04.007 : DirectoryExists(/012307)
DEBUG [FTPControlSocket] 3 dic 2013 17:53:04.007 : ---> CWD /012307
DEBUG [FTPControlSocket] 3 dic 2013 17:53:04.380 : 250 CWD successful. "/012307" is current directory.
DEBUG [FTPControlSocket] 3 dic 2013 17:53:04.380 : ---> CWD /
DEBUG [FTPControlSocket] 3 dic 2013 17:53:04.622 : 250 CWD successful. "/" is current directory.
DEBUG [FTPConnection] 3 dic 2013 17:53:04.622 : Exists(/012307/Busy)
DEBUG [FTPControlSocket] 3 dic 2013 17:53:04.622 : ---> MDTM /012307/Busy
DEBUG [FTPControlSocket] 3 dic 2013 17:53:04.848 : 550 File not found
DEBUG [FTPControlSocket] 3 dic 2013 17:53:04.849 : ---> PASV
DEBUG [FTPControlSocket] 3 dic 2013 17:53:05.074 : 227 Entering Passive Mode (188,219,74,146,196,63)
DEBUG [FTPControlSocket] 3 dic 2013 17:53:05.074 : Server supplied address=188.219.74.146
DEBUG [FTPControlSocket] 3 dic 2013 17:53:05.074 : Server supplied port=50239
DEBUG [FTPControlSocket] 3 dic 2013 17:53:05.074 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 3 dic 2013 17:53:05.074 : remoteAddr=188.219.74.146
DEBUG [FTPControlSocket] 3 dic 2013 17:53:05.074 : Substituting server supplied IP (188.219.74.146) with remote host IP (188.219.74.146)
DEBUG [FTPControlSocket] 3 dic 2013 17:53:05.074 : NewPassiveDataSocket(188.219.74.146,50239)
INFO [BaseSocket] 3 dic 2013 17:53:05.075 : Connecting to 188.219.74.146:50239 with timeout 5000 ms
DEBUG [BaseSocket] 3 dic 2013 17:53:05.245 : Successfully connected to 188.219.74.146:50239


EDT FTP .Net client debug lines when the application is NOT working:

DEBUG [FTPConnection] 3 dic 2013 17:54:49.951 : DirectoryExists(/012307)
DEBUG [FTPControlSocket] 3 dic 2013 17:54:49.951 : ---> CWD /012307
DEBUG [FTPControlSocket] 3 dic 2013 17:54:49.951 : 227 Entering Passive Mode (188,219,74,146,196,255)
DEBUG [FTPControlSocket] 3 dic 2013 17:54:49.951 : ---> CWD /
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.192 : 250 CWD successful. "/012307" is current directory.
DEBUG [FTPConnection] 3 dic 2013 17:54:50.192 : Exists(/012307/Busy)
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.192 : ---> PORT 192,168,1,120,144,88
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.192 : 250 CWD successful. "/" is current directory.
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.192 : ---> RETR /012307/Busy
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.377 : 200 Port command successful
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.381 : ---> PASV
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.381 : 550 File not found
DEBUG [FTPControlSocket] 3 dic 2013 17:54:50.381 : Expected reply codes = [227] (strict=False)
ERROR [FTPClient] 3 dic 2013 17:54:50.400 : Caught exception File not found (code=550)
DEBUG [FTPClient] 3 dic 2013 17:54:50.401 : Closing source stream
ERROR [FTPClient] 3 dic 2013 17:54:50.401 : Caught exception
ERROR [FTPClient] 3 dic 2013 17:54:50.401 : EnterpriseDT.Net.Ftp.FTPException: File not found (code=550)
ERROR [FTPClient] 3 dic 2013 17:54:50.401 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
ERROR [FTPClient] 3 dic 2013 17:54:50.401 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.CreateDataSocketPASVInternal()
ERROR [FTPClient] 3 dic 2013 17:54:50.401 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.CreateDataSocketPASV()
ERROR [FTPClient] 3 dic 2013 17:54:50.401 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.CreateDataSocket(FTPConnectMode connectMode)
ERROR [FTPClient] 3 dic 2013 17:54:50.401 :    in EnterpriseDT.Net.Ftp.FTPClient.InitPut(String remoteFile, Boolean append)
ERROR [FTPClient] 3 dic 2013 17:54:50.401 :    in EnterpriseDT.Net.Ftp.FTPClient.PutBinary(Stream srcStream, String remoteFile, Boolean append, Boolean alwaysCloseStreams)

7 Answers

0 votes
by (162k points)
Switch off KeepAlive - that might be polling the server.
0 votes
by (320 points)
Switch off KeepAlive - that might be polling the server.


Hi, thanks for your answer.
How can I set this option?
The FTPConnection class has no such property.
I am evaluating the free version of the EDT FTP .Net library.
Regards.
0 votes
by (320 points)
Here is a log showing the exact time where the answers start to arrive delayed.
At the beginning everything is working fine.
Then I get a "425 Can't open data connection." and "Expected reply codes = [200,250] (strict=False)".
From that moment on, all the answers arrive delayed and therefore misinterpreted by the client.


DEBUG [FTPConnection] 3 dic 2013 19:43:30.102 : Exists(/012307/Busy)
DEBUG [FTPControlSocket] 3 dic 2013 19:43:30.102 : ---> PORT 192,168,1,120,159,63
DEBUG [FTPControlSocket] 3 dic 2013 19:43:30.296 : 200 Port command successful
DEBUG [FTPControlSocket] 3 dic 2013 19:43:30.296 : ---> RETR /012307/Busy
DEBUG [FTPControlSocket] 3 dic 2013 19:43:30.441 : 150 Opening data channel for file transfer.
DEBUG [FTPConnection] 3 dic 2013 19:43:30.441 : DeleteFile(/012307/Busy)
DEBUG [FTPControlSocket] 3 dic 2013 19:43:30.441 : ---> DELE /012307/Busy
DEBUG [FTPControlSocket] 3 dic 2013 19:43:30.596 : 250 File deleted successfully
DEBUG [FTPConnection] 3 dic 2013 19:43:39.997 : DirectoryExists(/012307)
DEBUG [FTPControlSocket] 3 dic 2013 19:43:39.997 : ---> CWD /012307
DEBUG [FTPControlSocket] 3 dic 2013 19:43:40.745 : 250 CWD successful. "/012307" is current directory.
DEBUG [FTPControlSocket] 3 dic 2013 19:43:40.745 : ---> CWD /
DEBUG [FTPControlSocket] 3 dic 2013 19:43:41.091 : 425 Can't open data connection.
DEBUG [FTPControlSocket] 3 dic 2013 19:43:41.091 : Expected reply codes = [200,250] (strict=False)
DEBUG [FTPConnection] 3 dic 2013 19:43:55.107 : DirectoryExists(/012307)
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.107 : ---> CWD /012307
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.107 : 250 CWD successful. "/" is current directory.
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.107 : ---> CWD /
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.407 : 250 CWD successful. "/012307" is current directory.
DEBUG [FTPConnection] 3 dic 2013 19:43:55.407 : Exists(/012307/Busy)
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.408 : ---> PORT 192,168,1,120,159,68
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.434 : 250 CWD successful. "/" is current directory.
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.434 : ---> RETR /012307/Busy
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.696 : 200 Port command successful
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.700 : ---> PASV
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.742 : 550 File not found
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.742 : Expected reply codes = [227] (strict=False)
ERROR [FTPClient] 3 dic 2013 19:43:55.760 : Caught exception File not found (code=550)
DEBUG [FTPClient] 3 dic 2013 19:43:55.760 : Closing source stream
ERROR [FTPClient] 3 dic 2013 19:43:55.760 : Caught exception
ERROR [FTPClient] 3 dic 2013 19:43:55.760 : EnterpriseDT.Net.Ftp.FTPException: File not found (code=550)
ERROR [FTPClient] 3 dic 2013 19:43:55.760 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
ERROR [FTPClient] 3 dic 2013 19:43:55.760 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.CreateDataSocketPASVInternal()
ERROR [FTPClient] 3 dic 2013 19:43:55.760 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.CreateDataSocketPASV()
ERROR [FTPClient] 3 dic 2013 19:43:55.760 :    in EnterpriseDT.Net.Ftp.FTPControlSocket.CreateDataSocket(FTPConnectMode connectMode)
ERROR [FTPClient] 3 dic 2013 19:43:55.760 :    in EnterpriseDT.Net.Ftp.FTPClient.InitPut(String remoteFile, Boolean append)
ERROR [FTPClient] 3 dic 2013 19:43:55.760 :    in EnterpriseDT.Net.Ftp.FTPClient.PutBinary(Stream srcStream, String remoteFile, Boolean append, Boolean alwaysCloseStreams)
DEBUG [FTPConnection] 3 dic 2013 19:44:10.183 : DirectoryExists(/012307)
DEBUG [FTPControlSocket] 3 dic 2013 19:44:10.183 : ---> CWD /012307
0 votes
by (320 points)
I think the problem is that when the client issues
DEBUG [FTPControlSocket] 3 dic 2013 19:43:40.745 : ---> CWD /
I get
DEBUG [FTPControlSocket] 3 dic 2013 19:43:41.091 : 425 Can't open data connection. 
and the correct answer
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.107 : 250 CWD successful. "/" is current directory. 
is sent to the following command that made a different request
DEBUG [FTPControlSocket] 3 dic 2013 19:43:55.107 : ---> CWD /012307
, this leading to "delayed answers". How to avoid this? It looks like the answers are enqueued and sent delayed
0 votes
by (320 points)
This problem looks similar to this one: http://www.enterprisedt.com/forums/view ... hp?p=11924
Any comment?
0 votes
by (162k points)
It looks to me like the Exists method is causing you problems. It's a bit hacky, because FTP servers don't support an exists command.

I'd avoid using it - get a directory listing instead.
0 votes
by (320 points)
It looks to me like the Exists method is causing you problems. It's a bit hacky, because FTP servers don't support an exists command.
I'd avoid using it - get a directory listing instead.


Exactly, I have already tried to write my own version of Exists() and the application seems to work much better.
I also forcibly close and reopen the connection when I get an error from the FTP connection.
Regards.

Categories

...