C# Class Renci.SshNet.ForwardedPortLocal

Provides functionality for local port forwarding
Inheritance: ForwardedPort, IDisposable
Datei anzeigen Open project: sshnet/SSH.NET Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

ForwardedPortLocal ( string boundHost, string host, uint port ) : System

Initializes a new instance of the ForwardedPortLocal class.

ForwardedPortLocal ( string boundHost, uint boundPort, string host, uint port ) : System

Initializes a new instance of the ForwardedPortLocal class.

ForwardedPortLocal ( uint boundPort, string host, uint port ) : System

Initializes a new instance of the ForwardedPortLocal class.

Protected Methods

Method Description
CheckDisposed ( ) : void

Ensures the current instance is not disposed.

Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources

StartPort ( ) : void

Starts local port forwarding.

StopPort ( System.TimeSpan timeout ) : void

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

Private Methods

Method Description
AcceptCompleted ( object sender, SocketAsyncEventArgs e ) : void
Channel_Exception ( object sender, System.ExceptionEventArgs e ) : void
CloseClientSocket ( Socket clientSocket ) : void
InitializePendingChannelCountdown ( ) : void

Initializes the CountdownEvent.

When the port is started for the first time, a CountdownEvent is created with an initial count of 1.

On subsequent (re)starts, we'll dispose the current CountdownEvent and create a new one with initial count of 1.

InternalDispose ( bool disposing ) : void
InternalStart ( ) : void
InternalStop ( System.TimeSpan timeout ) : void
ProcessAccept ( Socket clientSocket ) : void
Session_Disconnected ( object sender, EventArgs e ) : void
Session_ErrorOccured ( object sender, System.ExceptionEventArgs e ) : void
StartAccept ( SocketAsyncEventArgs e ) : void
StopListener ( ) : void

Interrupts the listener, and waits for the listener loop to finish.

When the forwarded port is stopped, then any further action is skipped.

Method Details

CheckDisposed() protected method

Ensures the current instance is not disposed.
The current instance is disposed.
protected CheckDisposed ( ) : void
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Dispose() protected method

Releases unmanaged and - optionally - managed resources
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

ForwardedPortLocal() public method

Initializes a new instance of the ForwardedPortLocal class.
is null. is null. is greater than .
public ForwardedPortLocal ( string boundHost, string host, uint port ) : System
boundHost string The bound host.
host string The host.
port uint The port.
return System

ForwardedPortLocal() public method

Initializes a new instance of the ForwardedPortLocal class.
is null. is null. is greater than . is greater than .
public ForwardedPortLocal ( string boundHost, uint boundPort, string host, uint port ) : System
boundHost string The bound host.
boundPort uint The bound port.
host string The host.
port uint The port.
return System

ForwardedPortLocal() public method

Initializes a new instance of the ForwardedPortLocal class.
is greater than . is null. is greater than .
public ForwardedPortLocal ( uint boundPort, string host, uint port ) : System
boundPort uint The bound port.
host string The host.
port uint The port.
return System

StartPort() protected method

Starts local port forwarding.
protected StartPort ( ) : void
return void

StopPort() protected method

Stops local port forwarding, and waits for the specified timeout until all pending requests are processed.
protected StopPort ( System.TimeSpan timeout ) : void
timeout System.TimeSpan The maximum amount of time to wait for pending requests to finish processing.
return void