Table of Contents

Method ConnectAsync

Namespace
SshSharp
Assembly
SshSharp.dll

ConnectAsync(string, int, CancellationToken)

Connects to the proxy and asks it for a connection to host:port. The returned stream carries that connection; disposing it closes the connection to the proxy.

public Task<Stream> ConnectAsync(string host, int port, CancellationToken cancellationToken = default)

Parameters

host string
port int
cancellationToken CancellationToken

Returns

Task<Stream>

Exceptions

SshException

The proxy could not be reached, refused the connection or the credentials, or answered something that is not its protocol (ConnectFailed); or, once connected, did not complete its handshake within 30 seconds (Timeout).

ArgumentException

host is not an ASCII host name or address (give an internationalized name in its punycode form).