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

ForwardedPort

public abstract class ForwardedPort : IForwardedPort, IDisposable
Base class for port forwarding functionality.
public abstract bool IsStarted { get; }

Gets a value indicating whether port forwarding is started.

public event EventHandler Closing

The Closing event occurs as the forwarded port is being stopped.

Occurs when an exception is thrown.

Occurs when a port forwarding request is received.

protected ForwardedPort()

protected abstract void CheckDisposed()

Ensures the current instance is not disposed.

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 void RaiseExceptionEvent(Exception exception)

Raises Exception event.

protected void RaiseRequestReceived(string host, uint port)

Raises RequestReceived event.

public virtual void Start()

Starts port forwarding.

protected abstract void StartPort()

Starts port forwarding.

public virtual void Stop()

Stops port forwarding.

protected virtual void StopPort(TimeSpan timeout)

Stops port forwarding, and waits for the specified timeout until all pending requests are processed.