Back to product page

ForwardPort property


Determines if wodSSH will only forward data to remote port.

Type

A Long value. Port to which the remote server redirects the connection.

Syntax

  • Basic
object.ForwardPort [= value]
The ForwardPort(object,value) syntax has these parts:
objectAn expression evaluating to an object of type wodSSH.
valueA Long value.

Remarks

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

If you look at the code you will see that you set up login and password to access SSH (this may be the same as your email login credentials). They are sent encrypted using port 22 (SSH). After that, wodSSH will open a secured tunnel connection and force the remote server to connect locally (that is, locally from the server's point of view - it will connect to itself) to port 110 (POP3). We set ForwardHost to '127.0.0.1' which will be evaluated on the remote server and cause it to point to itself .

So, what now? As an example, you could use Winsock and accept connections on local port 110 on your computer. Using the above code, you can transfer everything that comes to local port 110 through wodSSH's secure connection to the remote side secured tunnel which points to remote port 110. Now set up your mail client program to use 'localhost' as its POP3 server - and all of your email will be encrypted during transfer over the network!

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

Platforms

Windows