Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Port fowarding not keep alive

$
0
0
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!

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>