Back to product page

PortForwardRequest method

Called when user wants to connect to other host through the server.




  • Basic
object.PortForwardRequest Owner, User, RemoteHost, RemotePort, Action
The PortForwardRequest(object,Owner,User,RemoteHost,RemotePort,Action) syntax has these parts:
objectAn expression evaluating to an object of type IwodSSHDNotify.
OwnerA wodSSHDcom object. Instance of wodSSHServer that called this notification method.
UserA SSHUser object. Reference to user who requested port forwarding.
RemoteHostA String value. Represents remote hostname where wodSSHServer should connect.
RemotePortA Long value. Port on remote server where wodSSHServer should connect.
ActionA SSHActions enumeration, as described in settings. Action to perform - Allow allows connection, Deny refuses it.


The settings for Action are:

Constant Value Description
Deny0 Deny execution of the action.
Allow 1 Allow to execute action.

This method is called only if you implemented IwodSSHNotify interface in your application, and wodSSHD.Notification property has received reference to instance of your implementation.

This notification method is called when connected user requests service from wodSSHD to connect to specific hostname/port on some other server. If you want to allow this action, set Action to Allow. wodSSHD will initiate connection with the server at that point. If connection is successfull, client will be notified, and wodSSHD will start forwarding data from the client to the end-point of forwarded connection, and vice versa.

Forward requests are typically used to protect plain communication from 3rd party sniffing (eavesdropping). For example, instead of connecting from his computer, client can request server to initiate connection for him. Complete traffic between wodSSHD server and the client will be encrypted (it's traveling through already established SSH connection).

You can change RemoteHost and RemotePort values from this notification. If you do so, client will not be aware of this change, and it will still think it got connected to the host/port for which his request was initiated.

If wodSSHD should bind some port on the server and accept connections, notification method PortBindRequest will be called.

Since version, it is possible that RemoteHost="" and RemotePort=0. This happens when you change service type in ServiceRequest notification method to stPortForwarding. This notification method is called in such cases so you can specify on which host and port user's service will be redirected..