Request a remote port forwarding. If successful, then forwarded connections will be redirected to the given target address. You can cancle a requested remote port forwarding by calling {@link #cancelRemotePortForwarding(int) cancelRemotePortForwarding()}.
A call of this method will block until the peer either agreed or disagreed to your request-
Note 1: this method typically fails if you
- pass a port number for which the used remote user has not enough permissions (i.e., port < 1024)
- or pass a port number that is already in use on the remote server
- or if remote port forwarding is disabled on the server.
Note 2: (from the openssh man page): By default, the listening socket on the server will be bound to the loopback interface only. This may be overriden by specifying a bind address. Specifying a remote bind address will only succeed if the server's GatewayPorts option is enabled (see sshd_config(5)).
@param bindAddress address to bind to on the server:
- "" means that connections are to be accepted on all protocol families supported by the SSH implementation
- "0.0.0.0" means to listen on all IPv4 addresses
- "::" means to listen on all IPv6 addresses
- "localhost" means to listen on all protocol families supported by the SSH implementation on loopback addresses only, [RFC3330] and RFC3513]
- "127.0.0.1" and "::1" indicate listening on the loopback interfaces for IPv4 and IPv6 respectively
@param bindPort port number to bind on the server (must be > 0)
@param targetAddress the target address (IP or hostname)
@param targetPort the target port
@throws IOException