Page 1 of 1

Format of server version is invalid

Posted: Tue 16 Oct 2012 13:48
by ulfb
Hi there,

I know, the question has been asked before (http://forums.devart.com/viewtopic.php?t=22848#p76406) the resolution was however not posted in the forum...

Im receiving a "Format of server version is invalid" exception when connecting to a customer's SFTP server using this code (please note, that the password is invalid):

procedure TmyForm.foo;
begin
ScFileStorage := TScFileStorage.Create(nil);
ScSSHClient := TScSSHClient.Create(nil);
ScSFTPClient := TScSFTPClient.Create(nil);

ScSSHClient.KeyStorage := ScFileStorage;
ScSFTPClient.SSHClient := ScSSHClient;
ScSSHClient.HostName := 'data.eon.leadflow.nl';
ScSSHClient.User := '[email protected]';
ScSSHClient.Password := 'blabla'; // password is invalid!
ScSSHClient.Port := 21;
ScSSHClient.OnServerKeyValidate := ScSSHClientServerKeyValidate;
ScSSHClient.Authentication := atPassword;
ScSSHClient.Connect;
end;

procedure TmyForm.ScSSHClientServerKeyValidate(Sender: TObject; NewServerKey: TScKey; var Accept: Boolean);
begin
Accept := True;
end;

Any suggestions?`

Thanks in advance

Ulf

Re: Format of server version is invalid

Posted: Fri 19 Oct 2012 09:48
by AndreyZ
Hello,

You are using the incorrect port, 21 is FTP port. SSH server works on the 22 port. To solve the problem, you should change port 21 to port 22 in your code.

Re: Format of server version is invalid

Posted: Fri 19 Oct 2012 12:06
by ulfb
Hello,

sure it's somewhat unusal, but reading my favourite's FTP client log I'm pretty sure it is port 21:

Code: Select all

Welcome to Core FTP, release ver 2.1, build 1593 (U) -- © 2003-2009
WinSock 2.0
Mem -- 4,194,303 KB, Virt -- 2,097,024 KB
Started on Friday October 19, 2012 at 13:17:PM
Resolving data.eon.leadflow.nl...  
Connect socket #936 to 79.99.134.80, port 21...
220 FTP Server ready.  
AUTH TLS  
234 AUTH TLS successful  
TLSv1, cipher TLSv1/SSLv3 (DHE-RSA-AES256-SHA) - 256 bit
USER [email protected]  
331 Password required for [email protected]  
PASS **********  
230 User [email protected] logged in  
SYST  
215 UNIX Type: L8  
Keep alive off...
PWD  
257 "/" is the current directory  
PBSZ 0  
200 PBSZ 0 successful  
PROT P  
200 Protection set to Private  
PASV  
227 Entering Passive Mode (79,99,134,80,137,29).  
LIST  
Connect socket #988 to 79.99.134.80, port 35101...
TLSv1, cipher TLSv1/SSLv3 (DHE-RSA-AES256-SHA) - 256

Re: Format of server version is invalid

Posted: Fri 19 Oct 2012 13:07
by AndreyZ
The SFTP protocol is not derived from the FTP protocol, and it is an independent protocol. Therefore, to solve the problem, you should set port for SSH server, not for FTP server.