Table of Contents

Class ConnectionInfo

Namespace
Renci.SshNet
Assembly
Renci.SshNet.dll

Represents remote connection information class.

public class ConnectionInfo

Inheritance

Derived

Inherited Members

Remarks

This class is NOT thread-safe. Do not use the same Renci.SshNet.ConnectionInfo with multiple client instances.

Constructors

ConnectionInfo(string, string, params AuthenticationMethod[])

Initializes a new instance of the Renci.SshNet.ConnectionInfo class.

public ConnectionInfo(string host, string username, params AuthenticationMethod[] authenticationMethods)

Parameters

host string

The host.

username string

The username.

authenticationMethods AuthenticationMethod[]

The authentication methods.

Exceptions

ArgumentNullException

host is null.

ArgumentException

host is a zero-length string.

ArgumentException

username is null, a zero-length string or contains only whitespace characters.

ArgumentNullException

authenticationMethods is null.

ArgumentException

No authenticationMethods specified.

ConnectionInfo(string, int, string, params AuthenticationMethod[])

Initializes a new instance of the Renci.SshNet.ConnectionInfo class.

public ConnectionInfo(string host, int port, string username, params AuthenticationMethod[] authenticationMethods)

Parameters

host string

The host.

port int

The port.

username string

The username.

authenticationMethods AuthenticationMethod[]

The authentication methods.

Exceptions

ArgumentNullException

host is null.

ArgumentException

username is null, a zero-length string or contains only whitespace characters.

ArgumentOutOfRangeException

port is not within System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort.

ArgumentNullException

authenticationMethods is null.

ArgumentException

No authenticationMethods specified.

ConnectionInfo(string, int, string, ProxyTypes, string, int, string, string, params AuthenticationMethod[])

Initializes a new instance of the Renci.SshNet.ConnectionInfo class.

public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params AuthenticationMethod[] authenticationMethods)

Parameters

host string

Connection host.

port int

Connection port.

username string

Connection username.

proxyType ProxyTypes

Type of the proxy.

proxyHost string

The proxy host.

proxyPort int

The proxy port.

proxyUsername string

The proxy username.

proxyPassword string

The proxy password.

authenticationMethods AuthenticationMethod[]

The authentication methods.

Exceptions

ArgumentNullException

host is null.

ArgumentException

username is null, a zero-length string or contains only whitespace characters.

ArgumentOutOfRangeException

port is not within System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort.

ArgumentNullException

proxyType is not Renci.SshNet.ProxyTypes.None and proxyHost is null.

ArgumentOutOfRangeException

proxyType is not Renci.SshNet.ProxyTypes.None and proxyPort is not within System.Net.IPEndPoint.MinPort and System.Net.IPEndPoint.MaxPort.

ArgumentNullException

authenticationMethods is null.

ArgumentException

No authenticationMethods specified.

Properties

AuthenticationMethods

Gets supported authentication methods for this connection.

public IList<AuthenticationMethod> AuthenticationMethods { get; }

Property Value

IList<AuthenticationMethod>

ChannelCloseTimeout

Gets or sets the timeout to use when waiting for a server to acknowledge closing a channel.

public TimeSpan ChannelCloseTimeout { get; set; }

Property Value

TimeSpan

Remarks

If a server does not send a SSH_MSG_CHANNEL_CLOSE message before the specified timeout elapses, the channel will be closed immediately.

ChannelRequests

Gets the supported channel requests for this connection.

public IDictionary<string, RequestInfo> ChannelRequests { get; }

Property Value

IDictionary<string, RequestInfo>

ClientVersion

Gets the client version.

public string ClientVersion { get; }

Property Value

string

CompressionAlgorithms

Gets supported compression algorithms for this connection.

public IDictionary<string, Func<Compressor>> CompressionAlgorithms { get; }

Property Value

IDictionary<string, Func<Compressor>>

CurrentClientCompressionAlgorithm

Gets the current client compression algorithm.

public string CurrentClientCompressionAlgorithm { get; }

Property Value

string

CurrentClientEncryption

Gets the current client encryption.

public string CurrentClientEncryption { get; }

Property Value

string

CurrentClientHmacAlgorithm

Gets the current client hash algorithm.

public string CurrentClientHmacAlgorithm { get; }

Property Value

string

CurrentHostKeyAlgorithm

Gets the current host key algorithm.

public string CurrentHostKeyAlgorithm { get; }

Property Value

string

CurrentKeyExchangeAlgorithm

Gets the current key exchange algorithm.

public string CurrentKeyExchangeAlgorithm { get; }

Property Value

string

CurrentServerCompressionAlgorithm

Gets the current server compression algorithm.

public string CurrentServerCompressionAlgorithm { get; }

Property Value

string

CurrentServerEncryption

Gets the current server encryption.

public string CurrentServerEncryption { get; }

Property Value

string

CurrentServerHmacAlgorithm

Gets the current server hash algorithm.

public string CurrentServerHmacAlgorithm { get; }

Property Value

string

Encoding

Gets or sets the character encoding.

public Encoding Encoding { get; set; }

Property Value

Encoding

Encryptions

Gets supported encryptions for this connection.

public IDictionary<string, CipherInfo> Encryptions { get; }

Property Value

IDictionary<string, CipherInfo>

HmacAlgorithms

Gets supported hash algorithms for this connection.

public IDictionary<string, HashInfo> HmacAlgorithms { get; }

Property Value

IDictionary<string, HashInfo>

Host

Gets connection host.

public string Host { get; }

Property Value

string

HostKeyAlgorithms

Gets supported host key algorithms for this connection.

public IDictionary<string, Func<byte[], KeyHostAlgorithm>> HostKeyAlgorithms { get; }

Property Value

IDictionary<string, Func<byte[], KeyHostAlgorithm>>

IsAuthenticated

Gets a value indicating whether connection is authenticated.

public bool IsAuthenticated { get; }

Property Value

bool

KeyExchangeAlgorithms

Gets supported key exchange algorithms for this connection.

public IDictionary<string, Func<IKeyExchange>> KeyExchangeAlgorithms { get; }

Property Value

IDictionary<string, Func<IKeyExchange>>

MaxSessions

Gets or sets maximum number of session channels to be open simultaneously.

public int MaxSessions { get; set; }

Property Value

int

Port

Gets connection port.

public int Port { get; }

Property Value

int

ProxyHost

Gets proxy connection host.

public string ProxyHost { get; }

Property Value

string

ProxyPassword

Gets proxy connection password.

public string ProxyPassword { get; }

Property Value

string

ProxyPort

Gets proxy connection port.

public int ProxyPort { get; }

Property Value

int

ProxyType

Gets proxy type.

public ProxyTypes ProxyType { get; }

Property Value

ProxyTypes

ProxyUsername

Gets proxy connection username.

public string ProxyUsername { get; }

Property Value

string

RetryAttempts

Gets or sets number of retry attempts when session channel creation failed.

public int RetryAttempts { get; set; }

Property Value

int

ServerVersion

Gets the server version.

public string ServerVersion { get; }

Property Value

string

Timeout

Gets or sets connection timeout.

public TimeSpan Timeout { get; set; }

Property Value

TimeSpan

Username

Gets connection username.

public string Username { get; }

Property Value

string

AuthenticationBanner

Occurs when authentication banner is sent by the server.

public event EventHandler<AuthenticationBannerEventArgs> AuthenticationBanner

Event Type

EventHandler<AuthenticationBannerEventArgs>