Hi
I am attempting to list files from an FTPS connection directory but getting the above exception. My connection code looks like:-
private static bool FTPSInitiateConnection(string address, string ftpUsername, string ftpPassword, Rebex.Net.Ftp client)
{
TlsParameters par = new TlsParameters();
par.CertificateVerifier = new FileTransferCustomVerifier();
//par.Options |= TlsOptions.StayConnected;
// Additional debugging information
client.LogWriter = new Rebex.FileLogWriter(@"C:\temp\rebex.log");
client.LogWriter.Level = Rebex.LogLevel.Verbose;
client.TlsDebug += new FtpTlsDebugEventHandler(client_TlsDebug);
client.CommandSent += new FtpCommandSentEventHandler(client_CommandSent);
client.ResponseRead += new FtpResponseReadEventHandler(client_ResponseRead);
client.Options |= FtpOptions.ConnectPassiveLater;
client.Options |= FtpOptions.IgnorePassiveModeAddress;
if (!string.IsNullOrWhiteSpace(_proxyAddress))
{
// Set the proxy if one is in use
client.Proxy = new FtpProxy(FtpProxyType.HttpConnect, _proxyAddress, Rebex.Net.Ftp.DefaultImplicitSslPort);
}
client.Connect(address,21, par,FtpSecurity.Explicit);
client.Secure(par);
try
{
string res = client.Login(ftpUsername, ftpPassword);
#region Tracing
if (FTPFileTransfer.ApplicationTracing.TraceVerbose)
{
Trace.TraceInformation(@"Log in result " + res);
}
#endregion
return true;
}
catch (Rebex.Net.FtpException ftpEx)
{
#region Tracing
if (FTPFileTransfer.ApplicationTracing.TraceError)
{
Trace.TraceError(ftpEx.ToString());
}
#endregion
return false;
}
}
but when I try and list the files from this connection I get an error...
foreach (FtpItem _filename in client.GetList() )
{
if (_filename.IsFile)
{
ret.Add(_filename.Name);
}
}
From the rebex log file:
2012-11-07 11:42:58.794 INFO Ftp(1) Response: 200 Type set to A.
2012-11-07 11:42:58.794 VERBOSE Ftp(1) TLS: Sent TLS packet:
17-03-01-00-00
2012-11-07 11:42:58.794 VERBOSE Ftp(1) TLS: Sent TLS packet:
17-03-01-00-06-50-41-53-56-0D-0A
2012-11-07 11:42:58.810 VERBOSE Ftp(1) Info: Sent data over control connection:
50-41-53-56-0D-0A
2012-11-07 11:42:58.810 INFO Ftp(1) Command: PASV
2012-11-07 11:42:58.934 VERBOSE Ftp(1) TLS: Received TLS packet:
17-03-01-00-31-32-32-37-20-45-6E-74-65-72-69-6E-67-20-50-61-73-73-69-76
65-20-4D-6F-64-65-20-28-31-36-39-2C-38-31-2C-31-37-32-2C-31-33-2C-36-37
2C-38-32-29-0D-0A
2012-11-07 11:42:58.934 VERBOSE Ftp(1) Info: Received data over control connection:
32-32-37-20-45-6E-74-65-72-69-6E-67-20-50-61-73-73-69-76-65-20-4D-6F-64
65-20-28-31-36-39-2C-38-31-2C-31-37-32-2C-31-33-2C-36-37-2C-38-32-29-0D
0A
2012-11-07 11:42:58.934 VERBOSE Ftp(1) Info: Response available to be received on control connection.
2012-11-07 11:42:58.934 INFO Ftp(1) Response: 227 Entering Passive Mode (169,81,172,13,67,82)
2012-11-07 11:42:58.934 INFO Ftp(1) Info: Using server address 169.81.172.13 instead of received address 169.81.172.13.
2012-11-07 11:42:58.934 VERBOSE Ftp(1) TLS: Sent TLS packet:
17-03-01-00-00
2012-11-07 11:42:58.934 VERBOSE Ftp(1) TLS: Sent TLS packet:
17-03-01-00-06-4C-49-53-54-0D-0A
2012-11-07 11:42:58.950 VERBOSE Ftp(1) Info: Sent data over control connection:
4C-49-53-54-0D-0A
2012-11-07 11:42:58.950 INFO Ftp(1) Command: LIST
2012-11-07 11:42:58.966 DEBUG Ftp(1) Info: Establishing data connection to 169.81.172.13:17234.
2012-11-07 11:43:20.111 DEBUG Ftp(1) Info: Error while starting data transfer: Rebex.Net.FtpException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 169.81.172.13:17234
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at wWGvS.BnRMAeZ.kRCyw(String , IPAddress , Int32 )
--- End of inner exception stack trace ---
at wWGvS.BnRMAeZ.kRCyw(String , IPAddress , Int32 )
--- End of inner exception stack trace ---
at wWGvS.BnRMAeZ.YqGDG(IAsyncResult , String )
at wWGvS.BnRMAeZ.cCoahHZ(IAsyncResult , Int32 )
at Rebex.Net.ProxySocket.EndConnect(IAsyncResult asyncResult)
at wWGvS.AoLBks.kRCyw(EndPoint )
--- End of inner exception stack trace ---
at wWGvS.AoLBks.kRCyw(EndPoint )
at Rebex.Net.Ftp.CgtFNEZ(String , Boolean , AoLBks , Int64 , String , String , Int64 , FtpTransferState )
Any thoughts/ideas? I've tried suggestions in similar threads here but to no avail...