Subject: Issues on using libssh2_channel_direct_tcpip

Issues on using libssh2_channel_direct_tcpip

From: Lillian Poon <>
Date: Tue, 6 Apr 2010 02:25:23 +0800

Hi Team,

I have been using libssh2 v1.2 to implement a custom SSH client on MacOS 10.6.x and it works well. Recently I started to add SSH tunneling function by using libssh2_channel_direct_tcpip but saw frequent disconnection, and still got no luck after switching to v1.2.4. I then tested using the direct_tcpip sample code and observed similar situation.

Basically, my test is establishing a tunnel between local port 9188 and port 9288 on the remote host which has an Apache proxy server listening to port 9288 -- by running the sample program "direct_tcpip x.x.x.x <id> <passwd> 9188 localhost 9288". Then I configure proxy setting on Firefox to use http proxy on localhost port 9188, expecting it to exchange data with the remote proxy server. It is seen that connection usually breaks after fetching a few pages and the error message "The server at localhost:9288 disconnected!" is shown. However, if I run openssh on Mac by "ssh -L 9188:localhost:9288 x.x.x.x" instead of the direct_tcpip binary, everything works perfectly fine.

I am grateful if somebody may tell me if there are any ways to turn on debugging on Libssh2 to check where the problem lies. Any kind of instructions/advice will be highly appreciated. Thanks in advance.


Lillian Poon
Received on 2010-04-05