<PackageReference Include="SSH.NET" Version="2020.0.1" />

ISession

interface ISession : IDisposable
Provides functionality to connect and interact with SSH server.

Gets or sets the connection info.

bool IsConnected { get; }

Gets a value indicating whether the session is connected.

Gets a WaitHandle that can be used to wait for the message listener loop to complete.

Gets the session semaphore that controls session channels.

Occurs when ChannelCloseMessage message received

Occurs when ChannelDataMessage message received

Occurs when ChannelEofMessage message received

Occurs when ChannelExtendedDataMessage message received

Occurs when ChannelFailureMessage message received

Occurs when ChannelOpenConfirmationMessage message received

Occurs when ChannelOpenFailureMessage message received

Occurs when ChannelOpenMessage message received

Occurs when ChannelRequestMessage message received

Occurs when ChannelSuccessMessage message received

Occurs when ChannelWindowAdjustMessage message received

Occurs when session has been disconnected from the server.

Occurs when an error occurred.

Occurs when host key received.

Occurs when RequestFailureMessage message received

Occurs when RequestSuccessMessage message received

Occurs when BannerMessage message is received from the server.

void Connect()

Connects to the server.

Create a new channel for a locally forwarded TCP/IP port.

IChannelForwardedTcpip CreateChannelForwardedTcpip(uint remoteChannelNumber, uint remoteWindowSize, uint remoteChannelDataPacketSize)

Creates a "forwarded-tcpip" SSH channel.

Create a new SSH session channel.

void Disconnect()

Disconnects from the server.

Called when client is disconnecting from the server.

void RegisterMessage(string messageName)

Registers SSH message with the session.

void SendMessage(Message message)

Sends a message to the server.

bool TrySendMessage(Message message)

Sends a message to the server.

WaitResult TryWait(WaitHandle waitHandle, TimeSpan timeout, out Exception exception)

Waits for the specified to receive a signal, using a TimeSpan to specify the time interval.

WaitResult TryWait(WaitHandle waitHandle, TimeSpan timeout)

Waits for the specified to receive a signal, using a TimeSpan to specify the time interval.

void UnRegisterMessage(string messageName)

Unregister SSH message from the session.

void WaitOnHandle(WaitHandle waitHandle)

Waits for the specified handle or the exception handle for the receive thread to signal within the connection timeout.

void WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)

Waits for the specified handle or the exception handle for the receive thread to signal within the specified timeout.