def request_port_forward(self, address, port, handler=None):
if not self.active:<EOL><INDENT>raise SSHException("<STR_LIT>")<EOL><DEDENT>port = int(port)<EOL>response = self.global_request(<EOL>"<STR_LIT>", (address, port), wait=True<EOL>)<EOL>if response is None:<EOL><INDENT>raise SSHException("<STR_LIT>")<EOL><DEDENT>if port == <NUM_LIT:0>:<EOL><INDENT>port = response.get_int()<EOL><DEDENT>if handler is None:<EOL><INDENT>def default_handler(channel, src_addr, dest_addr_port):<EOL><INDENT>self._queue_incoming_channel(channel)<EOL><DEDENT>handler = default_handler<EOL><DEDENT>self._tcp_handler = handler<EOL>return port<EOL>
Ask the server to forward TCP connections from a listening port on
the server, across this SSH session.

If a handler is given, that handler is called from a different thread
whenever a forwarded connection arrives.  The handler parameters are::

    handler(
        channel,
        (origin_addr, origin_port),
        (server_addr, server_port),
    )

where ``server_addr`` and ``server_port`` are the address and port that
the server was listening on.

If no handler is set, the default behavior is to send new incoming
forwarded connections into the accept queue, to be picked up via
`accept`.

:param str address: the address to bind when forwarding
:param int port:
    the port to forward, or 0 to ask the server to allocate any port
:param callable handler:
    optional handler for incoming forwarded connections, of the form
    ``func(Channel, (str, int), (str, int))``.

:return: the port number (`int`) allocated by the server

:raises:
    `.SSHException` -- if the server refused the TCP forward request