Back to product page

ForwardPort property


Port on remote server where you wish to forward your data.

Type

Integer. Specifies port value.

Syntax

  • C#
  • VB.NET
Int32 ForwardPort {get; set; };

Property ForwardPort As Int32

Remarks

Together with ForwardHost, you can make wodSSH.NET act as a 'tunnel' to make your regular socket connections secure. For instance, if you wish to read your email using POP3 protocol but don't want to send plaintext passwords over the network, you can make something like this:
 
           Ssh.Login = "something"
           Ssh.Password = "something"
           Ssh.HostName = "pop3.server.com" ' I assume here server supports SSH
           Ssh.Protocol = SupportedProtocols.SSHAuto
           Ssh.ForwardPort = 110
           Ssh.ForwardHost = "127.0.0.1"
           Ssh.Connect
 

Look at the code - you set up login and password to access SSH (this may be same as your email passwords). They are sent encrypted over port 22 (SSH). After that, wodSSH.NET will open secured tunnel connection and force remote server to connect locally (locally for the server!) to port 110. We used ForwardHost as '127.0.0.1' since for remote server it points to his localhost - which is remote server.

So, what now? For instance you can use Winsock and accept connections on local port 110 on your computer. Using code above, you can transfer everything that comes to local port 110 through wodSSH.NET's secure connection to remote side secured tunnel which points to port remote port 110. Now setup your mail client program to use 'localhost' as pop3 server - and complete email will be encrypted when transferring over the network!

To prove this is true, go to command prompt and enter 'NETSTAT -A' command. You should notice that there are no 'ESTABLISHED' connections between your computer and your pop3 server on port 110 - because everything travels through secured tunnel on port 22. Neat, isn't it?

Platforms

Windows