Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
34.7k views
in .NET FTP by (360 points)
I'm getting the message error given in the subject when trying to connect to an FTP server.
Below the code i'm using; the error is raised from the DownloadFile method (not from the Connect() method).

Note that if i try to connect to the same server with FILEZILLA from the same workstation i have no problem (after setting the active mode in FILEZILLA connection settings).


m_FtpConnection.ServerAddress = customerConfig.FtpServer;
m_FtpConnection.ServerPort = int.Parse(customerConfig.FtpPort);
m_FtpConnection.UserName = customerConfig.FtpUser;
m_FtpConnection.Password = customerConfig.FtpPwd;
m_FtpConnection.Timeout = 120000;
if (customerConfig.FtpMode == "active")
{
m_FtpConnection.ConnectMode = FTPConnectMode.ACTIVE;
}
else if (customerConfig.FtpMode == "pasv")
m_FtpConnection.ConnectMode = FTPConnectMode.PASV;
m_FtpConnection.TransferType = FTPTransferType.BINARY;
m_FtpConnection.Connect();
m_FtpConnection.DownloadFile("down.txt","index.txt");

12 Answers

0 votes
by (162k points)
Please enable logging at the Debug level, and send us the log file (zipped) along with the Filezilla log file.
0 votes
by (360 points)
Here it is the the two log file.
FILEZILLA.LOG with filezilla connection log.
FTPLOG.txt with my application FTPCONNECTION object log.
////////////////////////////////////
FILEZILLA.LOG
//////////////////////////////////
Stato: Connessione a 217.141.169.66:21...
Stato: Connessione stabilita, in attesa del messaggio di benvenuto...
Trace: CFtpControlSocket::OnReceive()
Risposta: 220 Microsoft FTP Service
Trace: CFtpControlSocket::SendNextCommand()
Comando: USER memar
Trace: CFtpControlSocket::OnReceive()
Risposta: 331 Password required for memar.
Trace: CFtpControlSocket::SendNextCommand()
Comando: PASS *****
Trace: CFtpControlSocket::OnReceive()
Risposta: 230-Consorzio CARICESE
Risposta: Area utenti FTP
Risposta: 230 User memar logged in.
Trace: CFtpControlSocket::SendNextCommand()
Comando: SYST
Trace: CFtpControlSocket::OnReceive()
Risposta: 215 Windows_NT
Trace: CFtpControlSocket::SendNextCommand()
Comando: FEAT
Trace: CFtpControlSocket::OnReceive()
Risposta: 211-FEAT
Risposta: SIZE
Risposta: MDTM
Risposta: 211 END
Stato: Connesso
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CFileZillaEnginePrivate::ResetOperation(0)
Stato: Lettura elenco cartelle...
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::ChangeDirSend()
Comando: PWD
Trace: CFtpControlSocket::OnReceive()
Risposta: 257 "/memar" is current directory.
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CFtpControlSocket::ParseSubcommandResult(0)
Trace: CFtpControlSocket::ListSubcommandResult()
Trace: state = 1
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: state = 1
Comando: TYPE I
Trace: CFtpControlSocket::OnReceive()
Risposta: 200 Type set to I.
Trace: CFtpControlSocket::TransferParseResponse()
Trace: code = 2
Trace: state = 1
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: state = 2
Comando: PORT 172,16,3,4,193,131
Trace: CFtpControlSocket::OnReceive()
Risposta: 200 PORT command successful.
Trace: CFtpControlSocket::TransferParseResponse()
Trace: code = 2
Trace: state = 2
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: state = 4
Comando: LIST
Trace: CFtpControlSocket::OnReceive()
Risposta: 150 Opening BINARY mode data connection for /bin/ls.
Trace: CFtpControlSocket::TransferParseResponse()
Trace: code = 1
Trace: state = 4
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: state = 5
Trace: CTransferSocket::OnAccept(0)
Trace: CTransferSocket::OnConnect
Trace: CTransferSocket::OnReceive(), m_transferMode=0
Trace: CTransferSocket::OnReceive(), m_transferMode=0
Trace: CTransferSocket::OnClose(0)
Trace: CTransferSocket::TransferEnd(1)
Trace: CFtpControlSocket::TransferEnd()
Trace: CFtpControlSocket::OnReceive()
Risposta: 226 Transfer complete.
Trace: CFtpControlSocket::TransferParseResponse()
Trace: code = 2
Trace: state = 7
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CFtpControlSocket::ParseSubcommandResult(0)
Trace: CFtpControlSocket::ListSubcommandResult()
Trace: state = 3
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Stato: Contenuto cartella letto con successo
Trace: CFileZillaEnginePrivate::ResetOperation(0)



//////////////////////////////////////////////////
FTPLOG.TXT
///////////////////////////////////////////////////
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.068 : Looking for subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO (fallback )
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.088 : Found license subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.088 : Did not find license subkeys Software\Enterprise Distributed Technologies\edtFTPnet PRO or in registry
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.089 : Looking for subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO (fallback )
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.089 : Found license subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.089 : Did not find license subkeys Software\Enterprise Distributed Technologies\edtFTPnet PRO or in registry
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.110 : Looking for subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO (fallback )
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.110 : Found license subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.110 : Did not find license subkeys Software\Enterprise Distributed Technologies\edtFTPnet PRO or in registry
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.110 : Looking for subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO (fallback )
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.111 : Found license subkey Software\Enterprise Distributed Technologies\edtFTPnet PRO
DEBUG [LicenseProperties] 9 mar 2012 08:39:30.111 : Did not find license subkeys Software\Enterprise Distributed Technologies\edtFTPnet PRO or in registry
DEBUG [FTPConnection] 9 mar 2012 08:39:30.127 : Set LocalDirectory='D:\MARCOVECCHI\LAVORO\SVILUPPO\MemarAutoFtp\MemarAutoFtp\bin\Debug'
DEBUG [FTPClient] 9 mar 2012 08:39:30.129 : Connecting to 217.141.169.66:21
DEBUG [HostNameResolver] 9 mar 2012 08:39:30.377 : Resolving 217.141.169.66
DEBUG [HostNameResolver] 9 mar 2012 08:39:30.396 : 217.141.169.66 resolved to 217.141.169.66
INFO [BaseSocket] 9 mar 2012 08:39:30.405 : Connecting to 217.141.169.66:21 with timeout 120000 ms
DEBUG [BaseSocket] 9 mar 2012 08:39:30.525 : Successfully connected to 217.141.169.66:21
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.525 : Setting socket timeout=120000
INFO [FTPControlSocket] 9 mar 2012 08:39:30.552 : Command encoding=System.Text.SBCSCodePageEncoding
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.555 : SetActivePortRange(1024,65000). NextPort=41458
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.555 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.580 : 220 Microsoft FTP Service
DEBUG [FTPConnection] 9 mar 2012 08:39:30.583 : Connected to 217.141.169.66 (instance=0)
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.587 : ---> USER memar
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.618 : 331 Password required for memar.
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.618 : ---> PASS ********
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.801 : 230-Consorzio CARICESE
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.802 : Area utenti FTP
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.802 : 230 User memar logged in.
DEBUG [FTPConnection] 9 mar 2012 08:39:30.802 : Successfully logged in
INFO [FTPConnection] 9 mar 2012 08:39:30.804 : Auto FEAT disabled
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.804 : ---> TYPE I
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.834 : 200 Type set to I.
DEBUG [FTPControlSocket] 9 mar 2012 08:39:30.835 : ---> PWD
DEBUG [FTPContro
0 votes
by (360 points)
Sorry in my last post i forgot to tell that the same code works without problem when my workstation is connected to internet outside of my office lan.
In the office we use a proxy, could this be the problem?
0 votes
by (162k points)
It's failing because it thinks all the ports are busy from 41000 or so.

What output do you get from netstat -a?
0 votes
by (360 points)
Here it is the NETSTAT -a output


Connessioni attive

Proto Indirizzo locale Indirizzo esterno Stato
TCP 0.0.0.0:135 NB-3:0 LISTENING
TCP 0.0.0.0:445 NB-3:0 LISTENING
TCP 0.0.0.0:3306 NB-3:0 LISTENING
TCP 0.0.0.0:3389 NB-3:0 LISTENING
TCP 0.0.0.0:6129 NB-3:0 LISTENING
TCP 0.0.0.0:8081 NB-3:0 LISTENING
TCP 0.0.0.0:11100 NB-3:0 LISTENING
TCP 0.0.0.0:17500 NB-3:0 LISTENING
TCP 0.0.0.0:47546 NB-3:0 LISTENING
TCP 0.0.0.0:49153 NB-3:0 LISTENING
TCP 0.0.0.0:49154 NB-3:0 LISTENING
TCP 0.0.0.0:49155 NB-3:0 LISTENING
TCP 0.0.0.0:49157 NB-3:0 LISTENING
TCP 0.0.0.0:49224 NB-3:0 LISTENING
TCP 0.0.0.0:49242 NB-3:0 LISTENING
TCP 10.1.250.24:139 NB-3:0 LISTENING
TCP 10.1.250.24:49190 VERUSKA:microsoft-ds ESTABLISHED
TCP 10.1.250.24:49192 MEMOSVR-R1:microsoft-ds ESTABLISHED
TCP 10.1.250.24:49194 MeMoNet18:microsoft-ds ESTABLISHED
TCP 10.1.250.24:49202 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49234 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49235 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49248 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49253 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49258 memonet533:51404 CLOSE_WAIT
TCP 10.1.250.24:49273 memonet533:54173 CLOSE_WAIT
TCP 10.1.250.24:49274 memonet533:54651 ESTABLISHED
TCP 10.1.250.24:49298 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49329 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49373 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49383 memonet335:1025 ESTABLISHED
TCP 10.1.250.24:49430 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49463 memonet335:1313 ESTABLISHED
TCP 10.1.250.24:49468 memonet533:remote-winsock ESTABLISHED
TCP 10.1.250.24:49879 memonet232:4502 ESTABLISHED
TCP 10.1.250.24:49880 memonet232:ms-sql-s ESTABLISHED
TCP 10.1.250.24:50140 memofsc:microsoft-ds ESTABLISHED
TCP 10.1.250.24:50714 memonet533:53884 ESTABLISHED
TCP 10.1.250.24:50771 memonet533:55733 TIME_WAIT
TCP 10.1.250.24:50773 memonet533:56680 ESTABLISHED
TCP 10.1.250.24:50782 memonet533:54668 TIME_WAIT
TCP 10.1.250.24:50784 memonet533:54766 FIN_WAIT_2
TCP 10.1.250.24:50786 memodc03:epmap TIME_WAIT
TCP 10.1.250.24:50787 memodc03:49155 TIME_WAIT
TCP 10.1.250.24:50793 memonet232:ms-sql-s TIME_WAIT
TCP 10.1.250.24:50794 memonet533:54766 ESTABLISHED
TCP 10.21.1.7:139 NB-3:0 LISTENING
TCP 127.0.0.1:5939 NB-3:0 LISTENING
TCP 127.0.0.1:19872 NB-3:49243 ESTABLISHED
TCP 127.0.0.1:49162 NB-3:0 LISTENING
TCP 127.0.0.1:49162 NB-3:49167 ESTABLISHED
TCP 127.0.0.1:49167 NB-3:49162 ESTABLISHED
TCP 127.0.0.1:49243 NB-3:19872 ESTABLISHED
TCP 127.0.0.1:49483 NB-3:0 LISTENING
TCP 127.0.0.1:62514 NB-3:0 LISTENING
TCP [::]:135 NB-3:0 LISTENING
TCP [::]:445 NB-3:0 LISTENING
TCP [::]:3306 NB-3:0 LISTENING
TCP [::]:3389 NB-3:0 LISTENING
TCP [::]:6129 NB-3:0 LISTENING
TCP [::]:47546 NB-3:0 LISTENING
TCP [::]:49153 NB-3:0 LISTENING
TCP [::]:49154 NB-3:0 LISTENING
TCP [::]:49155 NB-3:0 LISTENING
TCP [::]:49157 NB-3:0 LISTENING
TCP [::]:49224 NB-3:0 LISTENING
TCP [::]:49242 NB-3:0 LISTENING
TCP [::1]:6129 NB-3:49163 ESTABLISHED
TCP [::1]:49163 NB-3:6129 ESTABLISHED
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:3702 *:*
UDP 0.0.0.0:3702 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5355 *:*
UDP 0.0.0.0:6004 *:*
UDP 0.0.0.0:6129 *:*
UDP 0.0.0.0:8081 *:*
UDP 0.0.0.0:8082 *:*
UDP 0.0.0.0:17500 *:*
UDP 0.0.0.0:56332 *:*
UDP 0.0.0.0:65023 *:*
UDP 10.1.250.24:137 *:*
UDP 10.1.250.24:138 *:*
UDP 10.1.250.24:1900 *:*
UDP 10.1.250.24:63056 *:*
UDP 10.21.1.7:137 *:*
UDP 10.21.1.7:138 *:*
UDP 10.21.1.7:1900 *:*
UDP 10.21.1.7:63055 *:*
UDP 127.0.0.1:1900 *:*
UDP 127.0.0.1:49152 *:*
UDP 127.0.0.1:49153 *:*
UDP 127.0.0.1:49154 *:*
UDP 127.0.0.1:49155 *:*
UDP 127.0.0.1:50096 *:*
UDP 127.0.0.1:50097 *:*
UDP 127.0.0.1:50098 *:*
UDP 127.0.0.1:50099 *:*
UDP 127.0.0.1:50841 *:*
UDP 127.0.0.1:52638 *:*
UDP 127.0.0.1:52982 *:*
UDP 127.0.0.1:53863 *:*
UDP 127.0.0.1:54161 *:*
UDP 127.0.0.1:54162 *:*
UDP 127.0.0.1:54600 *:*
UDP 127.0.0.1:54601 *:*
UDP 127.0.0.1:55116 *:*
UDP 127.0.0.1:55241 *:*
UDP 127.0.0.1:55243 *:*
UDP 127.0.0.1:55385 *:*
UDP 127.0.0.1:55467 *:*
UDP 127.0.0.1:56036 *:*
UDP 127.0.0.1:60017 *:*
UDP 127.0.0.1:60018 *:*
UDP 127.0.0.1:60554 *:*
0 votes
by (162k points)
Sorry, I omitted to reply. Do you still have an issue?
0 votes
by (360 points)
Yes. The issue is still active. I've not been able to solve it.
0 votes
by (162k points)
I don't really understand why the ports are in use. Are you somehow running 2 instances of this? Is there anything more to your test code?
0 votes
by (360 points)
Absolutely no. I'm only running the application in VISUAL STUDIO debug ENVIRONMENT.
0 votes
by (162k points)
Email us at support at enterprisedt dot com and we'll send you a DLL with a change that we hope will work.

Categories

...