我正在尝试连接到SFTP服务器以下载一些文件。该代码用C#编写,我正在使用FluentFTP连接到FTP。客户端将端口设置为22。但是,当我尝试以下代码时,出现错误
由于意外的数据包格式,握手失败
任何使用FluentFTP的人都可以向我建议代码中缺少的内容。
FtpClient fclient = new FtpClient("xxx.yyy.com", "username", "password");
fclient.EncryptionMode = FtpEncryptionMode.Implicit;
fclient.SslProtocols = SslProtocols.Tls12;
fclient.Port = 22;
fclient.Connect();
谢谢。
答案 0 :(得分:1)
FluentFTP是FTP(S)客户端。
SFTP是完全不同的协议。另请参见Is "SFTP" and "FTP over SSL" a same thing?
您不能使用FluentFTP连接到SFTP服务器。