<PackageReference Include="SSH.NET" Version="2024.2.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)

Creates a WaitHandle array that is composed of system objects and the specified elements.

Creates a WaitHandle array that is composed of system objects and the specified elements.

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(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 waitHandleA, WaitHandle waitHandleB, int millisecondsTimeout)

Blocks the current thread until the specified WaitHandle gets signaled, using a 32-bit signed integer to specify the time interval in milliseconds.

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

Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed integer to specify the time interval.

public bool WaitOne(WaitHandle waitHandle, int millisecondsTimeout)

Blocks the current thread until the specified WaitHandle gets signaled, using a 32-bit signed integer to specify the time interval in milliseconds.

public void WaitOnHandle(WaitHandle waitHandle, int millisecondsTimeout)

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

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