This project is read-only.

Connection terminated... Error in forwarded port....

May 29, 2012 at 2:31 PM

Hi all,

I have in the last time many problems with the RDP forwarded port. I have established the SSH conntection to the ssh server, after than I start the RDP Client (MSTSC.EXE) to the local port. This works the most time good but in the last time the connection takes very long and I have a exception in the portforwarding. I can close only the program and start the program again for a new connection. Sometimes broke the connection and I have the same error....

I have write the error messages in the windows logfile. There are two error message at this time...

Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
   bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle)
   bei Renci.SshNet.Channels.ChannelDirectTcpip.Open(String remoteHost, UInt32 port, Socket socket)
   bei Renci.SshNet.ForwardedPortLocal.<>c__DisplayClass2.b__1()

System.Net.Sockets.SocketException: Eine bestehende Verbindung wurde softwaregesteuert
durch den Hostcomputer abgebrochen
   bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle)
   bei Renci.SshNet.Channels.ChannelDirectTcpip.Open(String remoteHost, UInt32 port, Socket socket)
   bei Renci.SshNet.ForwardedPortLocal.<>c__DisplayClass2.b__1()

The connection code is this....

if (client != null)
                {
                    
                    client.KeepAliveInterval = new TimeSpan(0, 1, 0);

                    client.Connect();
                    
                    // Create port forwards with error handling....

                    for (int i = 0; i < LPORT.Count; i++)
                    {
                        if (SOURCEHOST == null || SOURCEHOST == string.Empty)
                            SOURCEHOST = "127.0.0.1";

                        var forwarded = new ForwardedPortLocal(SOURCEHOST, (uint)LPORT[i], TARGETHOST[i], (uint)RPORT[i]);
                        forwarded.Exception += delegate(object sender, Renci.SshNet.Common.ExceptionEventArgs e)
                        {
                             try
                            {
                                WriteEventlogMessage("Error in the port forwarding:\n\n" + e.Exception.ToString(), 0, EventLogEntryType.Error);
                            }
                            catch (Exception)
                            {

                            }
                            // throw new Exception(e.Exception.ToString());
                        };
                        forwarded.Start();

                        client.AddForwardedPort(forwarded);
                    }
                }

I hope someone can help me with this problem. Big big thanks.....

Best regards,

Torakas

Jun 5, 2012 at 9:07 PM

Hi,

 

Based on "Session operation has timed out" error message, what happend is that SSH sends some command or channel request to the server but doesn't get any response back and times out.

 

If you can figure out, using source version, what request it times out for I could probably dig a little bit dipper into the problem.

 

Thanks,

Oleg