Subject: [libssh2] remote port forwarding

[libssh2] remote port forwarding

From: Eddy Valdes <>
Date: Fri, 21 Mar 2008 11:08:44 -0700 (PDT)

Has anybody successfully done remote port forwarding using libssh2? I can get local port forwarding to work well, but not remote port forwarding.

I have tried two different ways:

//libssh2_poll example

listener = libssh2_channel_forward_listen(session,3306);

retval = 0;

while (retval == 0)
        ssh_file_descriptor.type = LIBSSH2_POLLFD_LISTENER;
        ssh_file_descriptor.fd.listener = listener; = LIBSSH2_POLLFD_POLLIN;

        retval = libssh2_poll(&ssh_file_descriptor,1,500);

        printf("retval - %d, revents -%d\n",retval,ssh_file_descriptor.revents);

//Quick and dirty libssh_channel_forward accept

listener = libssh2_channel_forward_listen_ex(session,NULL,3306,NULL,16);

channel = libssh2_channel_forward_accept(listener);

Both methods successfully set up a listening socket on the remote box. In
the first example, when a connection attempt is made, the last call to
libssh2_poll never returns. In the second example, the call to
libssh2_channel_forward_accept never returns.

Any suggestions would be greatly appreciated.

Thank you.


This email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.

libssh2-devel mailing list
Received on 2008-03-21