Logo Search packages:      
Sourcecode: jenkins-trilead-ssh2 version File versions  Download package

synchronized void com::trilead::ssh2::Connection::requestRemotePortForwarding ( String  bindAddress,
int  bindPort,
String  targetAddress,
int  targetPort 
) throws IOException [inline]

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 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)).

bindAddressaddress to bind to on the server:

  • "" means that connections are to be accepted on all protocol families supported by the SSH implementation
  • "" 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]
  • "" and "::1" indicate listening on the loopback interfaces for IPv4 and IPv6 respectively
bindPortport number to bind on the server (must be > 0)
targetAddressthe target address (IP or hostname)
targetPortthe target port

Definition at line 1307 of file Connection.java.

            if (tm == null)
                  throw new IllegalStateException("You need to establish a connection first.");

            if (!authenticated)
                  throw new IllegalStateException("The connection is not authenticated.");

            if ((bindAddress == null) || (targetAddress == null) || (bindPort <= 0) || (targetPort <= 0))
                  throw new IllegalArgumentException();

            cm.requestGlobalForward(bindAddress, bindPort, targetAddress, targetPort);

Generated by  Doxygen 1.6.0   Back to index