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

SubsystemSession

Base class for SSH subsystem implementations.
public bool IsOpen { get; }

Gets a value indicating whether this session is open.

public int OperationTimeout { get; set; }

Occurs when the server has disconnected from the session.

Occurs when an error occurred.

protected SubsystemSession(ISession session, string subsystemName, int operationTimeout)

Initializes a new instance of the SubsystemSession class.

public void Connect()

Connects the subsystem using a new SSH channel session.

public WaitHandle[] CreateWaitHandleArray(WaitHandle waitHandle1, WaitHandle waitHandle2)

public void Disconnect()

Disconnects the subsystem channel.

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 abstract void OnChannelOpen()

Called when channel is open.

protected abstract void OnDataReceived(ArraySegment<byte> data)

Called when data is received.

protected void RaiseError(Exception error)

Raises the error.

public void SendData(byte[] data)

Sends data to the subsystem.

public int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout)

public void WaitOnHandle(WaitHandle waitHandle, int millisecondsTimeout)

Waits a specified time for a given WaitHandle to get signaled.

public Task WaitOnHandleAsync(WaitHandle waitHandle, int millisecondsTimeout, CancellationToken cancellationToken)

public Task<T> WaitOnHandleAsync<T>(TaskCompletionSource<T> tcs, int millisecondsTimeout, CancellationToken cancellationToken)