I'm trying to do the following thing in a C# program with SSH.NET :
ssh -NfD 1080 username@remote.com
Here's the code I produced :
using (var client = new SshClient("remote.com", "username", "password"))
{
client.Connect();
var port = new ForwardedPortLocal("localhost", 1080, "remote.com", 1080);
client.AddForwardedPort(port);
port.Exception += delegate(object sender, ExceptionEventArgs e)
{
Console.WriteLine(e.Exception.ToString());
};
port.Start();
}
Console.ReadKey();
I connect to an OpenVPN server through this tunnel. When I use the command line it works fine, but when I use the C# program it's like the tunnel isn't working, even if I can send commands to the server I'm connected to through the C# program. Any idea ?