Interface IBaseClient
Serves as base class for client implementations, provides common client functionality.
public interface IBaseClient : IDisposable
- Inherited Members
Properties
ConnectionInfo
Gets the connection info.
ConnectionInfo ConnectionInfo { get; }
Property Value
- ConnectionInfo
The connection info.
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
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
The keep-alive interval. Specify negative one (-1) milliseconds to disable the keep-alive. This is the default value.
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
CancellationTokenThe CancellationToken to observe.
Returns
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 KeepAliveInterval to configure the client to send a keep-alive at regular intervals.
Exceptions
- ObjectDisposedException
The method was called after the client was disposed.
Events
ErrorOccurred
Occurs when an error occurred.
event EventHandler<ExceptionEventArgs> ErrorOccurred
Event Type
HostKeyReceived
Occurs when host key received.
event EventHandler<HostKeyEventArgs> HostKeyReceived