Yes I agree that in below case using " libssh2_channel_direct_tcpip_ex "
I would only get raw TCP connection to "calih1" port 22 .
Here is what I am tring to achieve which I can easily do through putty .
I want to make two SSH connections, one to "calis1", and another through
that to "calih1", which is presumably not
directly reachable. But for that I would need two "plink" invocations,
as there is only ever at most one SSH connection per invocation of
I create a session called "calih1". It needs the following
Host Name: calih1
Connection type: SSH
Proxy type: Local
Telnet command: "\path\to\plink.exe -pw %pass %user@%proxyhost -nc
Proxy hostname: calis1
Proxy port: 22
Proxy username: root
Proxy password: <root_at_calis1's password>
Having created this session, you should now be able to execute
plink calih1 "ls -l"
and get the results of running "ls -l" on calih1.
How do I accomplish this using libssh2 .
[mailto:libssh2-devel-bounces_at_cool.haxx.se] On Behalf Of Peter Stuge
Sent: Tuesday, February 16, 2010 11:43 PM
Subject: Re: Help with libssh2_channel_direct_tcpip_ex
Kumar, Ashish wrote:
> while( ( channel = libssh2_channel_direct_tcpip_ex(
> session,targethostname , 22 , hostname, 22 ) ) == NULL)
> When I use the channel for below purpose
> while( (rc = libssh2_channel_exec(channel, commandline)) ==
> LIBSSH2_ERROR_EAGAIN );
> Can you give me hint to explore further into where could I be going
> wrong ?
You seem to be confusing the purpose of these function calls.
libssh2_channel_exec() can only be used with a channel that was
created by libssh2_channel_open_session().
libssh2_channel_direct_tcpip_ex() creates a different type of
channel. Please read RFC4254 to learn more about direct-tcpip
Received on 2010-02-17