Table of Contents

Interface IBaseClient

Namespace
Renci.SshNet
Assembly
Renci.SshNet.dll

Serves as base class for client implementations, provides common client functionality.

public interface IBaseClient : IDisposable

Implements

Properties

ConnectionInfo

Gets the connection info.

ConnectionInfo ConnectionInfo { get; }

Property Value

ConnectionInfo

Exceptions

ObjectDisposedException

The method was called after the client was disposed.

IsConnected

Gets a value indicating whether this client is connected to the server.

bool IsConnected { get; }

Property Value

bool

Exceptions

ObjectDisposedException

The method was called after the client was disposed.

KeepAliveInterval

Gets or sets the keep-alive interval.

TimeSpan KeepAliveInterval { get; set; }

Property Value

TimeSpan

Exceptions

ObjectDisposedException

The method was called after the client was disposed.

Methods

Connect()

Connects client to the server.

void Connect()

Exceptions

InvalidOperationException

The client is already connected.

ObjectDisposedException

The method was called after the client was disposed.

SocketException

Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.

SshConnectionException

SSH session could not be established.

SshAuthenticationException

Authentication of SSH session failed.

ProxyException

Failed to establish proxy connection.

ConnectAsync(CancellationToken)

Asynchronously connects client to the server.

Task ConnectAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The System.Threading.CancellationToken to observe.

Returns

Task

A System.Threading.Tasks.Task that represents the asynchronous connect operation.

Exceptions

InvalidOperationException

The client is already connected.

ObjectDisposedException

The method was called after the client was disposed.

SocketException

Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.

SshConnectionException

SSH session could not be established.

SshAuthenticationException

Authentication of SSH session failed.

ProxyException

Failed to establish proxy connection.

Disconnect()

Disconnects client from the server.

void Disconnect()

Exceptions

ObjectDisposedException

The method was called after the client was disposed.

SendKeepAlive()

Sends a keep-alive message to the server.

void SendKeepAlive()

Remarks

Use Renci.SshNet.IBaseClient.KeepAliveInterval to configure the client to send a keep-alive at regular intervals.

Exceptions

ObjectDisposedException

The method was called after the client was disposed.

ErrorOccurred

Occurs when an error occurred.

event EventHandler<ExceptionEventArgs> ErrorOccurred

Event Type

EventHandler<ExceptionEventArgs>

HostKeyReceived

Occurs when host key received.

event EventHandler<HostKeyEventArgs> HostKeyReceived

Event Type

EventHandler<HostKeyEventArgs>

ServerIdentificationReceived

Occurs when server identification received.

event EventHandler<SshIdentificationEventArgs>? ServerIdentificationReceived

Event Type

EventHandler<SshIdentificationEventArgs>?