This project is read-only.

Port fowarding not keep alive

Sep 9, 2013 at 8:35 PM
Hi,

Im trying to make an app which allows port fowarding features (using for change ip address) using SSH Tunnel.
Renci.SshNet.SshClient ssh = new Renci.SshNet.SshClient("174.34.150.202", "admin", "admin");
            ssh.Connect();
            
            Renci.SshNet.ForwardedPortDynamic port_fowarding = new Renci.SshNet.ForwardedPortDynamic(1080);
            port_fowarding.Exception += new EventHandler<Renci.SshNet.Common.ExceptionEventArgs>(port_fowarding_Exception);
            port_fowarding.RequestReceived += new EventHandler<Renci.SshNet.Common.PortForwardEventArgs>(port_fowarding_RequestReceived);
            ssh.AddForwardedPort(port_fowarding);
            port_fowarding.Start();
These code working fine after sometimes. But just around 30 second then i get an error:
Client not connected.
Looking as Socket has disconnected. How can i keep the port fowarding longer (around few hours or forever)

Thanks!