Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3k views
in .NET FTP by (120 points)
Trying to connect to a secure FTP server and it worked fine in FileZilla, but when I used the same credential in a batch download program, it failed and show me this in the log:

DEBUG [FTPConnection] 2 Jun 2009 15:37:54.356 : Set LocalDirectory='C:\pdp\Batch
Download\BatchDownload\bin\Debug'
INFO [LicenseProperties] 2 Jun 2009 15:37:54.356 : Licence expiry date: 12/31/99
99
INFO [LicenseProperties] 2 Jun 2009 15:37:54.356 : Production license
DEBUG [SSLFTPClient] 2 Jun 2009 15:37:54.356 : Connecting to 69.7.43.53:22
DEBUG [HostNameResolver] 2 Jun 2009 15:37:54.356 : 69.7.43.53 resolved to 69.7.43.53
DEBUG [SSLFTPControlSocket] 2 Jun 2009 15:37:54.372 : waitOnShutdownSSL=True
DEBUG [ExFTPControlSocket] 2 Jun 2009 15:37:54.387 : Connecting directly to ftp-
server 68.75.43.53:22
DEBUG [FTPControlSocket] 2 Jun 2009 15:37:54.543 : Setting socket timeout=120000

DEBUG [SecureSocket] 2 Jun 2009 15:37:54.543 : Set timeout=120000
DEBUG [SecureSocket] 2 Jun 2009 15:37:54.543 : Set timeout=120000
DEBUG [FTPControlSocket] 2 Jun 2009 15:37:54.559 : Command encoding=System.Text.
ASCIIEncoding
DEBUG [ExFTPControlSocket] 2 Jun 2009 15:37:54.559 : Created control-socket: Soc
ksContext=, ProxySettings=NoProxy, RemoteHost= 69.7.43.53, controlPort=22, timeo
ut=120000
DEBUG [FTPControlSocket] 2 Jun 2009 15:37:54.559 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 2 Jun 2009 15:37:54.653 : SSH-2.0-1.82 sshlib: WinSSHD
4.26
ERROR [FTPControlSocket] 2 Jun 2009 15:38:24.670 : Control channel unexpectedly
closed

DEBUG [AsyncProcessor] 2 Jun 2009 15:38:26.483 : Stopping FTP task processor.
DEBUG [AsyncProcessor] 2 Jun 2009 15:38:26.483 : FTP task processor stopped.
DEBUG [FTPFileFactory] 2 Jun 2009 15:38:26.483 : Defaulting to Unix parsing
DEBUG [FTPControlSocket] 2 Jun 2009 15:38:26.483 : ---> QUIT
ERROR [FTPControlSocket] 2 Jun 2009 15:38:26.483 : Control channel unexpectedly
closed



Below is my code
=================
// Instantiate SecureFTPConnection
SecureFTPConnection ftpConnection = new SecureFTPConnection();

SecureFTPConnection.LogLevel = LogLevel.All;
// set the license
ftpConnection.LicenseOwner = "DFDFDFD";
ftpConnection.LicenseKey = "XXX-XXXX-XXXX-XXXX";

// setting server address and credentials
ftpConnection.ServerAddress = serverAddress;
if (serverPort.Length != 0)
{
ftpConnection.ServerPort = Convert.ToInt32(serverPort);
}

ftpConnection.UserName = userName;
ftpConnection.Password = password;


ftpConnection.ServerValidation = SecureFTPServerValidationType.None;
// connect to the server
// By default, auto-login is on so Login doesn't need to be called
myLog.logtext("Connecting to server " + serverAddress);
ftpConnection.Connect();
myLog.logtext("Server connected!!");
ftpConnection.ChangeWorkingDirectory(initialDir);
============================================

1 Answer

0 votes
by (162k points)
You need to set the protocol - it is trying to connect to an SFTP server using FTPS.

ftpConnection.Protocol = FileTransferProtocol.SFTP;

Categories

...