Back to product page

Add method

Adds a new tunneling channel.


A Chanel object. Reference to newly created channel.


  • Basic
object.Add ([Type], [LocalAddress], [LocalPort], [RemoteAddress], [RemotePort])      
The Add(object,Type,LocalAddress,LocalPort,RemoteAddress,RemotePort) syntax has these parts:
objectAn expression evaluating to an object of type Channels.
TypeOptional. A Variant value. Determines if you are creating local port forwarding, remote port forwarding, or Socks proxy service (from ForwardTypes enumeration).
LocalAddressOptional. A Variant value. Holds the local IP address where the socket is bound.
LocalPortOptional. A Variant value. Local port used for listening and accepting connections.
RemoteAddressOptional. A Variant value. Holds the IP address where you want the SSH server to connect or where the SSH server will bind a socket for listening (ignored if Type = SocksProxy).
RemotePortOptional. A Variant value. Holds the port on the remote end to which you want to forward the channel or on which the SSH server will listen for incoming connections (ignored if Type = SocksProxy).


The settings for Action are:

Constant Value Description
LocalListen0 Local forwarding.
RemoteListen 1 Remote forwarding.
SocksProxy 2 Dynamic socks proxy forwarding.

The Add method will create a new channel and add it to the collection of all currently defined channels. After you create a channel, you should Start it to make it accept new connections.

Each channel can be defined as one of three possible types - LocalListen, RemoteListen or SocksProxy. When you define a new channel as LocalListen then the local computer will bind a new socket to the LocalAddress interface on LocalPort and when a new connection arrives it will forward it to the SSH server at RemoteAddress on RemotePort. So, wodSSHTunnel will initiate connections towards the SSH server in this case.

If a new channel is defined as RemoteListen, then SSH server will bind RemoteAddress on RemotePort (Note: RemoteAddress as seen from the SSH server's end!!). When a new connection comes to the selected RemotePort, the SSH server will send a notification to wodSSHTunnel, which will initiate a new connection towards the LocalAddress interface on LocalPort.

Defining a new channel as SocksProxy will cause wodSSHTunnel to open a local port (on the LocalAddress interface). When applications connect to that port it will provide information about the dynamic tunnel to be created - at the Hostname/Port required by the application. The SocksConnect and SocksBind events will fire to notify you about such operations. The RemoteAddress and RemotePort arguments are ignored when this type of tunnel is created - they cannot be predefined because the application will choose them on a per connection basis.

If you don't set up the optional arguments in the Add method, you must define them later on (but before you call the Start method!).