Subject: Re: libssh2_channel_direct_tcpip_ex

Re: libssh2_channel_direct_tcpip_ex

From: Peter Stuge <peter_at_stuge.se>
Date: Wed, 16 Dec 2009 17:50:17 +0100

Me Me wrote:
> I am trying to tunnel a MySQL connection thru
> libssh2_channel_direct_tcpip_ex.
..
> Once I have the channel, do I need to do anything with it?
> The MySQL client should take over from there with the
> communication, since it handles all the sockets, and I should just
> be able to give it 127.0.0.1 and it should connect. Am I
> completely misunderstanding the way this works?

Somewhat. You need to socket(), bind(3306), listen() and accept(),
and for each connected client you then create a direct-tcpip channel.

host,port=127.0.0.1,3306 (relative the SSH server side)
shost,sport=info from the addr returned by accept()

Then you pump data between channel and socket. Lots of fun.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-12-16