Adds the forwarded port.
Namespace: Renci.SshNetAssembly: Renci.SshNet (in Renci.SshNet.dll) Version: 0.1.0.0 (1.0.0.0)
Syntax
public void AddForwardedPort( ForwardedPort port )
Parameters
- port
- Type: Renci.SshNet ForwardedPort
The port.
Exceptions
| Exception | Condition |
|---|---|
| Forwarded port is already added to a different client. | |
| port is null. | |
| Renci.SshNet.Common SshConnectionException | Client is not connected. |
Examples
client.Connect(); var port = new ForwardedPortRemote(8082, "www.cnn.com", 80); client.AddForwardedPort(port); port.Exception += delegate(object sender, ExceptionEventArgs e) { Console.WriteLine(e.Exception.ToString()); }; port.Start(); Thread.Sleep(1000 * 60 * 20); // Wait 20 minutes for port to be forwarded port.Stop();
client.Connect(); var port = new ForwardedPortLocal(8082, "www.cnn.com", 80); client.AddForwardedPort(port); port.Exception += delegate(object sender, ExceptionEventArgs e) { Console.WriteLine(e.Exception.ToString()); }; port.Start(); Thread.Sleep(1000 * 60 * 20); // Wait 20 minutes for port to be forwarded port.Stop();
See Also