Subject: libssh2_channel_direct_tcpip_ex

libssh2_channel_direct_tcpip_ex

From: Me Me <decay40_at_gmail.com>
Date: Tue, 15 Dec 2009 20:22:23 -0500

Hi Everyone,

I have been at this for a while, and perhaps I am just not getting
something. I am trying to tunnel a MySQL connection thru
libssh2_channel_direct_tcpip_ex.

SSH is running on the same box as MySQL and I can successfully login to both
separately, using libssh2 and libmysqlclient respectively.

I get a channel back from:

libssh2_channel_direct_tcpip_ex(session, "192.168.1.170", 3306, "127.0.0.1",
3306);

192.168.1.170 is the host with SSH and MySQL, and I want to map port 3306
from the server to the local machine.

I have also tried it the opposite way:

libssh2_channel_direct_tcpip_ex(session, "127.0.0.1", 3306, "192.168.1.170",
3306);

to no avail.

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?

The MySQL error is : Can't connect to MySQL server on '127.0.0.1' (61)

Thanks.

D.

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