SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
SftpFileStream.Read(byte[], int, int)
only writes those bytes to the buffer that go beyond the number of bytes requested by the caller.SftpFileStream.SetLength(long value)
with System.IO.FileStream (PR #272):
SftpClient.(Begin)DownloadFile(...)
by asynchronously reading ahead chunks (issue #145 and #100).The IsAsync property was removed from SftpFileStream. Previously this property always returned false.
The read and write position in SftpFileStream are no longer tracked separately. Reading from or seeking in the SftpFileStream will now also affect the position at which a subsequent write is performed, and vice versa (issue #253).
For example, the following code snippet will now write "123456" to the console:
var buffer = Encoding.UTF8.GetBytes("123456");
using (var client = new SftpClient("host", "user", "pwd"))
{
client.Connect();
using (var ws = client.OpenWrite(path))
{
ws.Write(buffer, 0, 3);
}
using (var ws = client.OpenWrite(path))
{
ws.Seek(3, SeekOrigin.Begin);
ws.Write(buffer, 3, 3);
}
Console.WriteLine(client.ReadAllText(path, Encoding.UTF8));
}
To improve compatibility of SftpFileStream with System.IO.FileStream, Append mode is now only allowed when combined with write-only access (issue #267). This only affects SftpClient.Open(string path, FileMode mode, FileAccess access)
.
The following code snippet will now throw an ArgumentException:
using (var client = new SftpClient("host", "user", "pwd"))
{
client.Connect();
using (var fs = client.Open("/home/user/file.log", FileMode.Append, FileShare.Read))
{
}
}
Result: System.ArgumentException: Append mode can be requested only when combined with write-only access.
To improve compatibility of SftpClient with System.IO.File, the following methods now use UTF-8 encoding without a Byte-Order Mark (BOM):
void AppendAllLines(string path, IEnumerable<string> contents)
void AppendAllText(string path, string contents)
StreamWriter AppendText(string path)
StreamWriter CreateText(string path)
void WriteAllLines(string path, IEnumerable<string> contents)
void WriteAllLines(string path, string[] contents)
void WriteAllText(string path, string contents)
ConnectSocks5()
throws a ProxyException with a wrong message (issue #167).SftpFileStream.ReadByte()
throws ArgumentException when no data is available in read buffer (issue #173).The NuGet Package Manager in Visual Studio 2012 does not support packages in which a given dependency is defined for more than one TFM. Since a fix for this issue is not expected any time soon, we're reviving support for a binary distribution.
This plain .zip file contains the SSH.NET assembly, and where applicable any dependencies, for all supported target frameworks.
For Visual Studio 2015 and higher, the SSH.NET NuGet package remains our primary distribution mechanism.
ForwardedPort.Stop()
no longer throws ObjectDisposedException when the port is disposed.Disconnect()
and Dispose()
.Dispose()
throws exception when SSH session gets disconnected unexpectedly (issue #96).ScpClient.Upload(DirectoryInfo, string)
adds extra directory level (issue #128).ScpClient.Upload(DirectoryInfo, string)
applies timestamp of parent directory (issue #129).This is the first release of SSH.NET providing support for .NET Core and Universal Windows Platform 10 (UAP10.0). The support for .NET Core comes in the form of an assembly targeting the .NET Platform Standard 1.3 TFM.
The full list of the supported target frameworks for this release is:
Overall performance has been greatly improved. Some of the changes that contributed to these gains are:
The SSH.NET NuGet package is now our only binary distribution mechanism. We no longer provide zip files that contain the assembly for individual target frameworks.
Up to now, stopping a forwarding port would block until all pending requests have completed and all channels are closed. This could result in a serious slowdown when stopping a SshClient with multiple forwarding ports.
As of this release, pending requests will be interrupted and the port will gracefully stop once all channels are closed.
Allround improvements to the API documentation.
Exceptions that are thrown during async processing are no longer wrapped in a SshException. For example, the following code will now just work:
using (var client = new SftpClient(connectionInfo))
{
var asyncResult = client.BeginDownloadFile("/home/sshnet/remoteFileThatDoesNotExist", ms);
...
try
{
client.EndDownloadFile(asyncResult);
}
catch (SftpPathNotFoundException)
{
// we should be landing here
}
}
This is the first release of SSH.NET providing support for .NET Core. The focus for this release was feature completeness and stability. Future releases will focus on performance.
Up to now, stopping a forwarding port would block until all pending requests have completed and all channels are closed. This could result in a serious slowdown when stopping a SshClient with multiple forwarding ports.
As of this release, pending requests will be interrupted and the port will gracefully stop once all channels are closed.
Allround improvements to the API documentation.
Exceptions that are thrown during async processing are no longer wrapped in a SshException. For example, the following code will now just work:
using (var client = new SftpClient(connectionInfo))
{
var asyncResult = client.BeginDownloadFile("/home/sshnet/remoteFileThatDoesNotExist", ms);
...
try
{
client.EndDownloadFile(asyncResult);
}
catch (SftpPathNotFoundException)
{
// we should be landing here
}
}