When using dynamic port forwarding it starts well but after a couple of minutes of surfing it slows sown and when looking at the connections using netstat -na many are in a waiting state. Used for testing Firefox with a Socks 5 setting for the proxied connection. The bellow code was used for setting the proxy and testing.
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Renci.SshNet;
namespace PortFrwrdTest
{
class Program
{
static void Main(string[] args)
{
AuthenticationMethod[] authenticationMethods =
{
new PasswordAuthenticationMethod(args[0], args[1])
};
using (var client = new SshClient(new ConnectionInfo(args[2], args[0], authenticationMethods)))
{
Console.WriteLine("Connecting");
client.Connect();
if (client.IsConnected)
{
Console.WriteLine("Connection was succesful");
}
else
{
Console.WriteLine("Not connected");
return;
}
var frwport = new ForwardedPortDynamic("localhost", 8080);
client.AddForwardedPort(frwport);
Console.WriteLine("Starting Socks Proxy at port 8080");
frwport.Start();
Console.ReadLine();
Console.WriteLine("Stopping port forwarding");
frwport.Stop();
Console.WriteLine("Disconnecting");
client.Disconnect();
}
}
}
}
```
Comments: ** Comment from web user: drieseng **
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Renci.SshNet;
namespace PortFrwrdTest
{
class Program
{
static void Main(string[] args)
{
AuthenticationMethod[] authenticationMethods =
{
new PasswordAuthenticationMethod(args[0], args[1])
};
using (var client = new SshClient(new ConnectionInfo(args[2], args[0], authenticationMethods)))
{
Console.WriteLine("Connecting");
client.Connect();
if (client.IsConnected)
{
Console.WriteLine("Connection was succesful");
}
else
{
Console.WriteLine("Not connected");
return;
}
var frwport = new ForwardedPortDynamic("localhost", 8080);
client.AddForwardedPort(frwport);
Console.WriteLine("Starting Socks Proxy at port 8080");
frwport.Start();
Console.ReadLine();
Console.WriteLine("Stopping port forwarding");
frwport.Stop();
Console.WriteLine("Disconnecting");
client.Disconnect();
}
}
}
}
```
Comments: ** Comment from web user: drieseng **
This should be fixed in the upcoming beta 2 release.