Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).

SFTP help

no avatar
User

izziy

Posts

1

Joined

Wed Jun 03, 2009 6:52 am

SFTP help

by izziy » Wed Jun 03, 2009 7:03 am

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.************ = "DFDFDFD";
ftpConnection.********* = "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);
============================================
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: SFTP help

by support2 » Wed Jun 03, 2009 11:48 am

You need to set the protocol - it is trying to connect to an SFTP server using FTPS.

ftpConnection.Protocol = FileTransferProtocol.SFTP;

Who is online

Users browsing this forum: No registered users and 14 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign