John,
I just made some improvments and fixes to port forwarding feature and seems to be working better, at leas after I ran this test:
using (var ssh = new SshClient(connectionInfo)) { ssh.Connect();//var port1 = ssh.AddForwardedPort<ForwardedPortLocal>("localhost", 8084, "www.renci.org", 80);var port1 = new ForwardedPortLocal("localhost", 8084, "www.renci.org", 80); ssh.AddForwardedPort(port1); port1.Exception += delegate(object sender, ExceptionEventArgs e) { Console.WriteLine(e.Exception.ToString()); }; port1.RequestReceived += delegate(object sender, PortForwardEventArgs e) { Console.WriteLine(e.OriginatorHost + ":" + e.OriginatorPort); }; port1.Start();var globalCounter = 0; System.Threading.Tasks.Parallel.For(0, 10000, new ParallelOptions { MaxDegreeOfParallelism = 40, }, (counter) => { Interlocked.Increment(ref globalCounter);var req = HttpWebRequest.Create("http://localhost:8084");using (var response = req.GetResponse()) {var r = new StreamReader(response.GetResponseStream());var output = r.ReadToEnd(); Console.WriteLine(string.Format("{3}\tRequest: {0}\tTime: {1}\tLength: {2}", counter, DateTime.Now, output.Length, globalCounter)); } } ); Thread.Sleep(1000 * 60 * 10); port1.Stop(); ssh.Disconnect(); }
Can you please checkout latest code and see if it fixes your problem?
Thanks,
Oleg