Renci.SshNet.Async
Renci.SshNet.Async copied to clipboard
Extends Renci.SshNet to implement the task-based async pattern
Renci.SshNet.Async

About
A collection of extensions for SSH.NET that implement the Task-based Asynchronous Pattern
from the originally implemented Asynchronous Programming Model
Install
You can install Renci.SshNet.Async from Nuget:
PM> Install-Package Renci.SshNet.Async
Usage
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();
Supported Operations
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