Class ForwardedPort
Base class for port forwarding functionality.
public abstract class ForwardedPort : IForwardedPort, IDisposable
- Inheritance
-
ForwardedPort
- Implements
- Derived
- Inherited Members
Constructors
ForwardedPort()
protected ForwardedPort()
Properties
IsStarted
Gets a value indicating whether port forwarding is started.
public abstract bool IsStarted { get; }
Property Value
Methods
CheckDisposed()
Ensures the current instance is not disposed.
protected abstract void CheckDisposed()
Exceptions
- ObjectDisposedException
The current instance is disposed.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolto release both managed and unmanaged resources; to release only unmanaged resources.
RaiseExceptionEvent(Exception)
Raises Exception event.
protected void RaiseExceptionEvent(Exception exception)
Parameters
exception
ExceptionThe exception.
RaiseRequestReceived(string, uint)
Raises RequestReceived event.
protected void RaiseRequestReceived(string host, uint port)
Parameters
Start()
Starts port forwarding.
public virtual void Start()
Exceptions
- InvalidOperationException
The current ForwardedPort is already started -or- is not linked to a SSH session.
- SshConnectionException
The client is not connected.
StartPort()
Starts port forwarding.
protected abstract void StartPort()
Stop()
Stops port forwarding.
public virtual void Stop()
StopPort(TimeSpan)
Stops port forwarding, and waits for the specified timeout until all pending requests are processed.
protected virtual void StopPort(TimeSpan timeout)
Parameters
timeout
TimeSpanThe maximum amount of time to wait for pending requests to finish processing.
Events
Closing
The Closing event occurs as the forwarded port is being stopped.
public event EventHandler Closing
Event Type
Exception
Occurs when an exception is thrown.
public event EventHandler<ExceptionEventArgs> Exception
Event Type
RequestReceived
Occurs when a port forwarding request is received.
public event EventHandler<PortForwardEventArgs> RequestReceived