I am trying to connect to SFTP server to download some files. The code is written in C# and I am using FluentFTP to connect to the FTP. Client has given port as 22. But when I try the following code, I am getting the error
The handshake failed due to an unexpected packet format
Anyone who worked on FluentFTP can suggest me what I am missing in my code.
FtpClient fclient = new FtpClient("xxx.yyy.com", "username", "password");
fclient.EncryptionMode = FtpEncryptionMode.Implicit;
fclient.SslProtocols = SslProtocols.Tls12;
fclient.Port = 22;
fclient.Connect();
Thanks.
FluentFTP is FTP(S) client.
SFTP is a completely different protocol. See also Is "SFTP" and "FTP over SSL" a same thing?
You cannot use FluentFTP to connect to an SFTP server. You have to use another SFTP library, see SFTP Libraries for .NET.