SSH establish connect + through proxy socks5

Jul 15, 2016 at 2:46 AM
Edited Jul 15, 2016 at 2:49 AM
Hello,

I have this code:
private void Connect()
        {
            if (client == null)
            {
                client = new SshClient("myproxy.net", txtUser.Text, txtPassword.Text);
                client.KeepAliveInterval = new TimeSpan(0, 0, 20);
                client.ConnectionInfo.Timeout = new TimeSpan(0, 0, 20);

                ActiveConnection();
            }
            else if (!client.IsConnected)
            {
                ActiveConnection();
            }
        }

        private void ActiveConnection()
        {
            client.Connect();
            ForwardedPortDynamic port = new ForwardedPortDynamic(20140);
            client.AddForwardedPort(port);
            port.Start();
        }
And i use Proxifier to pass all package using socks5 of an application windows from port 20140 to my server ubuntu, but some times dont works correctly, this config on my code are correct? When i using the Putty, i have no problem.

Log on connect Proxifier:
[07.14 20:55:12] Client_tos.exe - 52.200.186.80:7215 open through proxy 127.0.0.1:20140 SOCKS5

I can replace Proxifier for any code from SSH.NET Library?

Thanks a lot.