0 votes
by (160 points)
edited

Program works on 15+PC's but doesn't on 1. It connects,changes directory then timeouts on getlist.

Bad PC:

2014-30-10 10:43:14.280 Opening log file.
2014-30-10 10:43:14.311 INFO Ftp(1) Command: USER *********
2014-30-10 10:43:14.389 INFO Ftp(1) Response: 331 Password required for 
2014-30-10 10:43:14.389 INFO Ftp(1) Command: PASS *********
2014-30-10 10:43:14.499 INFO Ftp(1) Response: 230 User logged in
2014-30-10 10:43:14.514 INFO Ftp(1) Command: OPTS UTF8 ON
2014-30-10 10:43:14.577 INFO Ftp(1) Response: 200 UTF8 set to on
2014-30-10 10:43:14.608 INFO Ftp(1) Command: CWD rwa/GEMS_NET
2014-30-10 10:43:14.670 INFO Ftp(1) Response: 250 CWD command successful
2014-30-10 10:43:14.670 DEBUG Ftp(1) Info: Starting data transfer.
2014-30-10 10:43:14.670 INFO Ftp(1) Command: TYPE A
2014-30-10 10:43:14.733 INFO Ftp(1) Response: 200 Type set to A
2014-30-10 10:43:14.733 INFO Ftp(1) Command: PASV
2014-30-10 10:43:14.795 INFO Ftp(1) Response: 227 Entering Passive Mode (68,195,249,146,148,208)
2014-30-10 10:43:14.795 DEBUG Ftp(1) Info: Establishing data connection.
2014-30-10 10:43:14.795 INFO Ftp(1) Command: MLSD
2014-30-10 10:43:14.920 INFO Ftp(1) Response: 150 Opening ASCII mode data connection for MLSD
2014-30-10 10:43:45.922 INFO Ftp(1) Response: 226 Transfer complete
2014-30-10 10:44:15.923 INFO Ftp(1) Info: Timing out.
2014-30-10 10:44:15.970 ERROR Ftp(1) Info: Error while reading data: Rebex.Net.FtpException: Timeout exceeded.
   at Rebex.Net.Ftp.CheckTimeout()
   at Rebex.Net.FtpDownloadStream.Receive(Byte[] buffer, Int32 offset, Int32 count)
   at Rebex.Net.FtpDownloadStream.Read(Byte[] buffer, Int32 offset, Int32 count)
2014-30-10 10:44:15.970 ERROR Ftp(1) Info: Rebex.Net.FtpException: Timeout exceeded.
   at Rebex.Net.Ftp.CheckTimeout()
   at Rebex.Net.FtpDownloadStream.Receive(Byte[] buffer, Int32 offset, Int32 count)
   at Rebex.Net.FtpDownloadStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at Rebex.Net.BandwidthStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at Rebex.Net.Ftp.DownloadFile(String command, Stream outputStream, Int64 remoteOffset)
2014-30-10 10:44:15.970 DEBUG Ftp(1) Info: Closing downloading data connection.
2014-30-10 10:44:15.970 DEBUG Ftp(1) Info: Transfer ended successfully.
2014-30-10 10:44:15.970 DEBUG Ftp(1) Info: Data connection closed.

Good PC:

2014-30-10 10:30:15.289 Opening log file.
2014-30-10 10:30:15.299 INFO Ftp(1) Command: USER *********
2014-30-10 10:30:15.489 INFO Ftp(1) Response: 331 Password required for 
2014-30-10 10:30:15.489 INFO Ftp(1) Command: PASS *********
2014-30-10 10:30:15.999 INFO Ftp(1) Response: 230 User logged in
2014-30-10 10:30:16.009 INFO Ftp(1) Command: OPTS UTF8 ON
2014-30-10 10:30:16.049 INFO Ftp(1) Response: 200 UTF8 set to on
2014-30-10 10:30:16.109 INFO Ftp(1) Command: CWD rwa/GEMS_NET
2014-30-10 10:30:16.179 INFO Ftp(1) Response: 250 CWD command successful
2014-30-10 10:30:16.199 DEBUG Ftp(1) Info: Starting data transfer.
2014-30-10 10:30:16.209 INFO Ftp(1) Command: TYPE A
2014-30-10 10:30:16.239 INFO Ftp(1) Response: 200 Type set to A
2014-30-10 10:30:16.239 INFO Ftp(1) Command: PASV
2014-30-10 10:30:16.279 INFO Ftp(1) Response: 227 Entering Passive Mode (68,195,249,146,217,118).
2014-30-10 10:30:16.289 DEBUG Ftp(1) Info: Establishing data connection.
2014-30-10 10:30:16.339 INFO Ftp(1) Command: MLSD
2014-30-10 10:30:16.369 INFO Ftp(1) Response: 150 Opening ASCII mode data connection for MLSD
2014-30-10 10:30:16.839 DEBUG Ftp(1) Info: Data transfer ended.
2014-30-10 10:30:16.839 DEBUG Ftp(1) Info: Closing downloading data connection.
2014-30-10 10:30:16.849 DEBUG Ftp(1) Info: Waiting for data transfer ending message.
2014-30-10 10:30:16.889 INFO Ftp(1) Response: 226 Transfer complete
2014-30-10 10:30:16.889 DEBUG Ftp(1) Info: Data transfer ended.
2014-30-10 10:30:16.889 DEBUG Ftp(1) Info: Transfer ended successfully.
2014-30-10 10:30:16.889 DEBUG Ftp(1) Info: Data connection closed.
...

Regards, Mark

Applies to: Rebex FTP/SSL

2 Answers

0 votes
by (144k points)
edited

In the FTP protocol, an end of file and directory listing is indicated by the FTP server closing the data connection, but it looks like the "bad PC" never got informed that the connection was closed. Therefore, the FTP client timed out after no data was received over the data connection for 30 seconds.

This is unlikely to be caused by a bug in Rebex FTP/SSL or in the server. Usually, issues like this are caused by FTP-aware routers, firewall or antivirus software along the way. However, without additional information, we can't tell for sure. A log of communication at the TCP protocol level produced by network protocol analyzer such as Wireshark would make it possible to rule out a bug in the client (if ran at the client side) or the server (if ran at the server side).

Things to try:

  • Try using legacy LIST command instead of MLSD command to retrieve the listing. Some FTP-aware firewalls might be unable to handle MLSD properly. To force this command, do this: ftp.EnabledExtensions &= ~FtpExtensions.MachineProcessingList; (where 'ftp' is an instance of Ftp object).
  • Try using a third-party FTP client such as FileZilla to see whether the issue has anything to do with Rebex FTP/SSL.
  • Try using FTP over TLS/SSL. TLS/SSL encryption makes it impossible for any applications or devices along the way to interfere with the communication. The drawback is that FTP over TLS/SSL is not firewall-friendly.

Also, as a general recommendation - when possible, consider using SFTP instead of FTP. It's more firewall-friendly because it doesn't need a new TCP connection for each listing or file transfer.

0 votes
by (160 points)
edited

Stand alone Windows 7 PC Firewall is off, antivirus is off, PC plugged directly into modem/router Command line FTP works and Filezilla works

2014-05-11 13:00:46.036 Opening log file.
2014-05-11 13:00:46.116 INFO Ftp(1) Command: USER ***
2014-05-11 13:00:46.186 INFO Ftp(1) Response: 331 Password required for ***
2014-05-11 13:00:46.186 INFO Ftp(1) Command: PASS *********
2014-05-11 13:00:46.303 INFO Ftp(1) Response: 230 User rwauser logged in
2014-05-11 13:00:46.308 INFO Ftp(1) Command: OPTS UTF8 ON
2014-05-11 13:00:46.358 INFO Ftp(1) Response: 200 UTF8 set to on
2014-05-11 13:00:46.388 INFO Ftp(1) Command: CWD rwa
2014-05-11 13:00:46.458 INFO Ftp(1) Response: 250 CWD command successful
2014-05-11 13:00:46.458 INFO Ftp(1) Command: CWD GEMS_NET 
2014-05-11 13:00:46.518 INFO Ftp(1) Response: 550 GEMS_NET : No such file or directory
2014-05-11 13:00:46.558 ERROR Ftp(1) Info: Rebex.Net.FtpException: GEMS_NET : No such file or directory (550).
   at Rebex.Net.Ftp.ReadResponse(Int32 success)
   at Rebex.Net.Ftp.Execute(String command)
by (144k points)
edited

Did you use the Windows command line FTP? Interestingly, it uses active FTP mode, which is even less firewall-friendly than passive mode (which is used by default by most other clients). The last time I checked, FileZilla tries passive mode by default as well, but tries active mode if it doesn't work. Please try setting Ftp object's Passive property to false before retrieving any listings or transfering files and let me know whether it makes any difference. If it doesn't, could you post the FileZilla log as well? We might spot some difference there!

...