Subject: Re: help in understanding _direct_tcpip_ex()

Re: help in understanding _direct_tcpip_ex()

From: Dor Zaidenberg <>
Date: Sat, 3 Jul 2010 02:54:22 +0300


thank you for your swift reply, sorry it took me such a long time to answer
I joined on digest mode and I did not find a way to reply to your message
I am no more registered on digest so things should work much better from now

>"No, since then you would require a tunnel in the other direction, a
>so-called "forwarded-tcpip" tunnel, going from the remote server to
>your local machine.
>That is a different type of channel from "direct-tcpip" and it is
>currently not implemented in libssh2. "
Ok.... , assuming I have complete control on the remote server I wish to
connect to, is there any action I can perform on that remote server, on the
system level, that will make this tunnel working?

>"Part of the reason may be that this type of tunnel (forwarded-tcpip)
>requires libssh2 to dynamically create channels, based on nothing but
>packets from the remote host. This does not fit so well with how
>libssh2 was designed.
>That said, I think it would be great if libssh2 also supported
>forwarded-tcpip channels, so please look into adding it! :)"
I am considering this, but honestly I cant afford to invest a long period of
work on this matter
Can you give provide me with a focus on the pieces of code need to be
changed and an exlanation of what I need to do
or a link to a good place that will explain?
If the scope of work for adding this capability is 2-3 days I will do it.
I would much appriciate if you could provide me with a focus and some
guidlines of what I need to do.

10x in advance Dor
On Thu, Jul 1, 2010 at 2:55 PM, Dor Zaidenberg <>wrote:

> 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

Live Long And Prosper
Dor Zaidenberg

Received on 2010-07-03