The example is based on Renci.sshNet Library. Actually it is a genuinely undocumented library, well the site has some documentation yet it’s not too supportive for this kind of task, so I spent several hours to develop this projects from scratch. When the project is created you need to install Renci.SshNet library using Visual Studio NuGet Package Manager console from Visual Studio Tool menu. After opening Package Manager Console execute the following command “Install-Package SSH.net” and Rensi.SshNet will be added to the project references. The presented example is console .Net application, the full code may be downloaded from here.
The main part tunnelText.exe application code is:
The application connects to the ssh server and begins listening on the bound port for ssh client connection. The total connection diagram looks like:
The tunnelTest application may be starte4d from command prompt and uses the following arguments (the order is important): bound end point, remote ssh server end point, ssh user name and ssh password. For example:
The network connection status and associated processes for such port forwarding looks like presented below:
where 19136 is tunnelTest PID, 6132 is putty PID, 10.199.30.14:22 is ssh server IP and port, 127.0.0.1:5022 is listening port opened by tunnelTest application, 49218 is ephemeral port assigned to putty.
I want code which is suppose to download from your post
http://ladydebug.com/blog/codes/PortForwarder.zip