带有dll的免费SFTP客户端,用C#上传和下载文件

use*_*591 7 .net c# ftp client sftp

我正在寻找免费的SFTP客户端.此外,它应该有一个免费的DLL,使用它我可以编写代码来上传和下载C#(.NET框架)文件.

例如以下代码不是免费的,它有30天免费评估,我想免费,

Chilkat.SFtp sftp = new Chilkat.SFtp();

bool success;
success = sftp.UnlockComponent("Anything for 30-day trial");

sftp.ConnectTimeoutMs = 5000;
sftp.IdleTimeoutMs = 10000;

int port;
string hostname;
hostname = "www.my-ssh-server.com";
port = 22;
success = sftp.Connect(hostname,port);

success = sftp.AuthenticatePw("myLogin","myPassword");

success = sftp.InitializeSftp();

string handle;
handle = sftp.OpenFile("hamlet.xml","readOnly","openExisting");

success = sftp.DownloadFile(handle,"c:/temp/hamlet.xml");

success = sftp.CloseHandle(handle);
MessageBox.Show("Success.");
Run Code Online (Sandbox Code Playgroud)

Nob*_*ody 6

我目前正在使用SharpSSH,它是免费的,并且有一个非常好的简单界面.SharpSSH sourcefoge页面.它具有您提到的所有身份验证功能.

你可以在C#中做到这一点:

var sftp = new Sftp(hostName, userName, password);
sftp.Connect(port);
sftp.Put(putFilePath, toDir);
sftp.Get(getFilePath);
Run Code Online (Sandbox Code Playgroud)