Subject: help in understanding _direct_tcpip_ex()

help in understanding _direct_tcpip_ex()

From: Dor Zaidenberg <>
Date: Thu, 1 Jul 2010 14:55:01 +0300

Dear all.

I am trying to use libssh2_channel_direct_tcpip_ex in order to establish a
tunnel between the localmachine and a server. To this end I am working with
the direct_tcpip exmaple (both local machine and remote server use linux)

I figured this is going to be very simple.
What I tried is :
./direct_tcpip <server_ip> <user> <pwd> 80 localhost 20000
I hoped this will tunnel the my local machine's port 80 to the remote host
at port 20000.
Then at the remote server I will type :
curl http://localhost:20000/test.php and it will be as if I connected to the
local machine.

Unfortionatly I got an error message (which is related to the 80)
saying "bind : address already in use"

I take it that this is because the apache server on my local machine listens
to port 80, but isn't that the point of tunneling?

I am sure that I am missing something very basic (and stupid) in this, can
someone show me the light ?

my end goal is not to tunnel port 80, but to tunnel port 554 which is used
for rtsp protocol but its easy to test with port 80

Live Long And Prosper
Dor Zaidenberg

Received on 2010-07-01