A collection of extensions for SSH.NET that implement the Task-based Asynchronous Pattern
from the originally implemented Asynchronous Programming Model
You can install Renci.SshNet.Async from Nuget:
PM> Install-Package Renci.SshNet.Async
The code sample below demonstrates how the extension methods are used.
// initialize client and connect like you normally would
var client = new SftpClient("host", "username", "password");
client.Connect();
// await a directory listing
var listing = await client.ListDirectoryAsync(".");
// await a file upload
using (var localStream = File.OpenRead("path_to_local_file"))
{
await client.UploadAsync(localStream, "upload_path");
}
// disconnect like you normally would
client.Disconnect();
Not all operations expose async methods in the base library. The extension methods introduced by this library are listed below:
SftpClient.ListDirectoryAsync
SftpClient.DownloadAsync
SftpClient.UploadAsync
SftpClient.SynchronizeDirectoriesAsync
SshCommand.ExecuteAsync