Class ForwardedPort
- Namespace
- Renci.SshNet
- Assembly
- Renci.SshNet.dll
Base class for port forwarding functionality.
public abstract class ForwardedPort : IForwardedPort, IDisposable
Inheritance
Derived
Implements
Inherited Members
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
bool-
to release both managed and unmanaged resources; to release only unmanaged resources.
RaiseExceptionEvent(Exception)
Raises Renci.SshNet.ForwardedPort.Exception event.
protected void RaiseExceptionEvent(Exception exception)
Parameters
exception
Exception-
The exception.
RaiseRequestReceived(string, uint)
Raises Renci.SshNet.ForwardedPort.RequestReceived event.
protected void RaiseRequestReceived(string host, uint port)
Parameters
Start()
Starts port forwarding.
public virtual void Start()
Exceptions
- InvalidOperationException
-
The current Renci.SshNet.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
TimeSpan-
The maximum amount of time to wait for pending requests to finish processing.
Closing
The Renci.SshNet.ForwardedPort.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