0 votes
by (160 points)
edited

Hi,

i am facing an issue when I call the _ftp.GetList() method for a directory on remote server. This error occurs for this directory only, may be because this directory has a lot of files that are about 1-2 mb. The FtpException being fired is "An established connection was aborted by the software in your host machine. ". I have disabled windows firewall and disabled my antivirus as well. But this issue is still occurring.

Any help will be appreciated.

Here is the log: Please note that i have replaced some critical info with xxxxx

2010-05-17 17:10:30.331 Opening log file.
2010-05-17 17:10:30.340 INFO Ftp(1) Command: PWD
2010-05-17 17:10:30.665 INFO Ftp(1) Response: 257 "/" is current directory.
2010-05-17 17:10:30.668 INFO Ftp(1) Command: CWD /
2010-05-17 17:10:30.993 INFO Ftp(1) Response: 250 CWD command successful.
2010-05-17 17:10:31.006 DEBUG Ftp(1) Info: Starting data transfer.
2010-05-17 17:10:31.007 INFO Ftp(1) Command: TYPE A
2010-05-17 17:10:31.330 INFO Ftp(1) Response: 200 Type set to A.
2010-05-17 17:10:31.333 INFO Ftp(1) Command: PASV
2010-05-17 17:10:31.663 INFO Ftp(1) Response: 227 Entering Passive Mode (xxx,xxx,xx,xxx,19,156).
2010-05-17 17:10:31.667 DEBUG Ftp(1) Info: Establishing data connection to xxx,xxx,xx,xxx:5020.
2010-05-17 17:10:31.994 INFO Ftp(1) Command: LIST
2010-05-17 17:10:32.318 INFO Ftp(1) Response: 125 Data connection already open; Transfer starting.
2010-05-17 17:10:32.338 DEBUG Ftp(1) Info: Data transfer ended.
2010-05-17 17:10:32.339 DEBUG Ftp(1) Info: Closing downloading data connection.
2010-05-17 17:10:32.341 DEBUG Ftp(1) Info: Waiting for data transfer ending message.
2010-05-17 17:10:32.857 INFO Ftp(1) Response: 226 Transfer complete.
2010-05-17 17:10:32.857 DEBUG Ftp(1) Info: Data transfer ended.
2010-05-17 17:10:32.857 DEBUG Ftp(1) Info: Transfer ended successfully.
2010-05-17 17:10:32.857 DEBUG Ftp(1) Info: Data connection closed.
2010-05-17 17:11:05.879 INFO Ftp(3) Command: PWD
2010-05-17 17:11:06.203 INFO Ftp(3) Response: 257 "/" is current directory.
2010-05-17 17:11:06.204 INFO Ftp(3) Command: PWD
2010-05-17 17:11:06.529 INFO Ftp(3) Response: 257 "/" is current directory.
2010-05-17 17:11:06.584 INFO Ftp(3) Command: CWD //uploads
2010-05-17 17:11:06.911 INFO Ftp(3) Response: 250 CWD command successful.
2010-05-17 17:11:06.912 DEBUG Ftp(3) Info: Starting data transfer.
2010-05-17 17:11:06.912 INFO Ftp(3) Command: TYPE A
2010-05-17 17:11:07.259 INFO Ftp(3) Response: 200 Type set to A.
2010-05-17 17:11:07.259 INFO Ftp(3) Command: PASV
2010-05-17 17:11:08.934 INFO Ftp(3) Response: 227 Entering Passive Mode (xxx,xxx,xx,xxx,19,157).
2010-05-17 17:11:08.934 DEBUG Ftp(3) Info: Establishing data connection to xxx,xxx,xx,xxx:5021.
2010-05-17 17:11:09.284 INFO Ftp(3) Command: LIST
2010-05-17 17:11:09.611 INFO Ftp(3) Response: 125 Data connection already open; Transfer starting.
2010-05-17 17:11:09.614 DEBUG Ftp(3) Info: Data transfer ended.
2010-05-17 17:11:09.614 DEBUG Ftp(3) Info: Closing downloading data connection.
2010-05-17 17:11:09.615 DEBUG Ftp(3) Info: Waiting for data transfer ending message.
2010-05-17 17:11:10.135 INFO Ftp(3) Response: 226 Transfer complete.
2010-05-17 17:11:10.136 DEBUG Ftp(3) Info: Data transfer ended.
2010-05-17 17:11:10.136 DEBUG Ftp(3) Info: Transfer ended successfully.
2010-05-17 17:11:10.136 DEBUG Ftp(3) Info: Data connection closed.
2010-05-17 17:11:31.022 INFO Ftp(4) Command: CWD //uploads/xxxxxxxxx
2010-05-17 17:11:32.882 INFO Ftp(4) Response: 250 CWD command successful.
2010-05-17 17:11:32.882 INFO Ftp(4) Command: PWD
2010-05-17 17:11:33.204 INFO Ftp(4) Response: 257 "/uploads/xxxxxxxxx" is current directory.
2010-05-17 17:11:33.204 DEBUG Ftp(4) Info: Starting data transfer.
2010-05-17 17:11:33.204 INFO Ftp(4) Command: TYPE A
2010-05-17 17:11:33.526 INFO Ftp(4) Response: 200 Type set to A.
2010-05-17 17:11:33.527 INFO Ftp(4) Command: PASV
2010-05-17 17:11:33.852 INFO Ftp(4) Response: 227 Entering Passive Mode (xxx,xxx,xx,xxx,19,158).
2010-05-17 17:11:33.853 DEBUG Ftp(4) Info: Establishing data connection to xxx,xxx,xx,xxx:5022.
2010-05-17 17:11:34.179 INFO Ftp(4) Command: LIST
2010-05-17 17:11:34.508 INFO Ftp(4) Response: 125 Data connection already open; Transfer starting.
2010-05-17 17:11:35.509 INFO Ftp(4) Response: 226 Transfer complete.
2010-05-17 17:12:45.497 INFO Ftp(5) Command: PWD
2010-05-17 17:12:45.818 INFO Ftp(5) Response: 257 "/" is current directory.
2010-05-17 17:12:45.820 INFO Ftp(5) Command: CWD /
2010-05-17 17:12:46.145 INFO Ftp(5) Response: 250 CWD command successful.
2010-05-17 17:12:46.149 DEBUG Ftp(5) Info: Starting data transfer.
2010-05-17 17:12:46.149 INFO Ftp(5) Command: TYPE A
2010-05-17 17:12:46.470 INFO Ftp(5) Response: 200 Type set to A.
2010-05-17 17:12:46.470 INFO Ftp(5) Command: PASV
2010-05-17 17:12:46.796 INFO Ftp(5) Response: 227 Entering Passive Mode (xxx,xxx,xx,xxx,19,160).
2010-05-17 17:12:46.796 DEBUG Ftp(5) Info: Establishing data connection to xxx,xxx,xx,xxx:5024.
2010-05-17 17:12:47.118 INFO Ftp(5) Command: LIST
2010-05-17 17:12:47.454 INFO Ftp(5) Response: 125 Data connection already open; Transfer starting.
2010-05-17 17:12:47.465 DEBUG Ftp(5) Info: Data transfer ended.
2010-05-17 17:12:47.465 DEBUG Ftp(5) Info: Closing downloading data connection.
2010-05-17 17:12:47.466 DEBUG Ftp(5) Info: Waiting for data transfer ending message.
2010-05-17 17:12:47.975 INFO Ftp(5) Response: 226 Transfer complete.
2010-05-17 17:12:47.975 DEBUG Ftp(5) Info: Data transfer ended.
2010-05-17 17:12:47.975 DEBUG Ftp(5) Info: Transfer ended successfully.
2010-05-17 17:12:47.975 DEBUG Ftp(5) Info: Data connection closed.
2010-05-17 17:13:27.618 INFO Ftp(7) Command: PWD
2010-05-17 17:13:27.940 INFO Ftp(7) Response: 257 "/" is current directory.
2010-05-17 17:13:31.153 INFO Ftp(7) Command: PWD
2010-05-17 17:13:31.479 INFO Ftp(7) Response: 257 "/" is current directory.
2010-05-17 17:13:32.775 INFO Ftp(7) Command: PWD
2010-05-17 17:13:33.100 INFO Ftp(7) Response: 257 "/" is current directory.
2010-05-17 17:13:33.690 INFO Ftp(7) Command: CWD //uploads
2010-05-17 17:13:34.017 INFO Ftp(7) Response: 250 CWD command successful.
2010-05-17 17:13:37.185 DEBUG Ftp(7) Info: Starting data transfer.
2010-05-17 17:13:37.186 INFO Ftp(7) Command: TYPE A
2010-05-17 17:13:37.510 INFO Ftp(7) Response: 200 Type set to A.
2010-05-17 17:13:37.510 INFO Ftp(7) Command: PASV
2010-05-17 17:13:37.850 INFO Ftp(7) Response: 227 Entering Passive Mode (xxx,xxx,xx,xxx,19,161).
2010-05-17 17:13:37.850 DEBUG Ftp(7) Info: Establishing data connection to xxx,xxx,xx,xxx:5025.
2010-05-17 17:13:38.179 INFO Ftp(7) Command: LIST
2010-05-17 17:13:38.508 INFO Ftp(7) Response: 125 Data connection already open; Transfer starting.
2010-05-17 17:13:38.511 DEBUG Ftp(7) Info: Data transfer ended.
2010-05-17 17:13:38.511 DEBUG Ftp(7) Info: Closing downloading data connection.
2010-05-17 17:13:38.511 DEBUG Ftp(7) Info: Waiting for data transfer ending message.
2010-05-17 17:13:39.031 INFO Ftp(7) Response: 226 Transfer complete.
2010-05-17 17:13:39.031 DEBUG Ftp(7) Info: Data transfer ended.
2010-05-17 17:13:39.031 DEBUG Ftp(7) Info: Transfer ended successfully.
2010-05-17 17:13:39.031 DEBUG Ftp(7) Info: Data connection closed.
2010-05-17 17:14:04.463 INFO Ftp(8) Command: CWD //uploads/xxxxxxxxx
2010-05-17 17:14:04.832 INFO Ftp(8) Response: 250 CWD command successful.
2010-05-17 17:14:04.832 INFO Ftp(8) Command: PWD
2010-05-17 17:14:05.159 INFO Ftp(8) Response: 257 "/uploads/xxxxxxxxx" is current directory.
2010-05-17 17:14:05.159 DEBUG Ftp(8) Info: Starting data transfer.
2010-05-17 17:14:05.159 INFO Ftp(8) Command: TYPE A
2010-05-17 17:14:05.483 INFO Ftp(8) Response: 200 Type set to A.
2010-05-17 17:14:05.484 INFO Ftp(8) Command: PASV
2010-05-17 17:14:05.808 INFO Ftp(8) Response: 227 Entering Passive Mode (xxx,xxx,xx,xxx,19,163).
2010-05-17 17:14:05.808 DEBUG Ftp(8) Info: Establishing data connection to xxx,xxx,xx,xxx:5027.
2010-05-17 17:14:06.132 INFO Ftp(
Applies to: Rebex FTP/SSL
by (160 points)
the issue is solved thankfully. the problem was that the ftp instance (by default) was connecting in passive mode. when i changed it to active mode, the getfile() returned list without any issues. Just for my curiosity, what is the difference between active/passive mode in this ftp client?

1 Answer

0 votes
by (13.0k points)
edited

Nice to know that you have solved it. Here is the difference between active and passive modes:

FTP uses two connections - one for sending commands and the second one for transferring files and directory listing.

In active mode:

  • The client sends the server the IP address port number that the client will use for the data connection
  • and the server opens the connection
  • you must allow incoming traffic on your firewall

In passive mode:

  • The server sends the client an IP address and port number
  • Client opens the connection to the server

The passive mode is more firewall friendly.

...