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

BaseClient

public abstract class BaseClient : IBaseClient, IDisposable
Serves as base class for client implementations, provides common client functionality.

Gets the connection info.

public virtual bool IsConnected { get; }

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

public TimeSpan KeepAliveInterval { get; set; }

Gets or sets the keep-alive interval.

Occurs when an error occurred.

Occurs when host key received.

Occurs when server identification received.

protected BaseClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo)

Initializes a new instance of the BaseClient class.

protected void CheckDisposed()

Check if the current instance is disposed.

public void Connect()

Connects client to the server.

public Task ConnectAsync(CancellationToken cancellationToken)

Asynchronously connects client to the server.

public void Disconnect()

Disconnects client from the server.

public void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

protected virtual void Dispose(bool disposing)

Releases unmanaged and - optionally - managed resources.

protected virtual void OnConnected()

Called when client is connected to the server.

protected virtual void OnConnecting()

Called when client is connecting to the server.

protected virtual void OnDisconnected()

Called when client is disconnected from the server.

protected virtual void OnDisconnecting()

Called when client is disconnecting from the server.

public void SendKeepAlive()

Sends a keep-alive message to the server.