Subject: Re: Direct tcp ip channel - session handshake

Re: Direct tcp ip channel - session handshake

From: Jiri <werwolfthron_at_gmail.com>
Date: Sun, 23 Sep 2012 16:43:27 +0200

>You must have two sessions of course. You haven't posted code so Idon't
know, it's not clear from your explanation.

>> but the program stops during handshake.

>Then you are simply not correctly passing data across the
three connections that your application has open.

Sample source code (without errors etc)
...
previous code same as direct tcp example
...
set_nonblock(listensock); //method for set nonblocking
forwardsock = accept(listensock, (struct sockaddr *)&sin, &sinlen);

shost = inet_ntoa(sin.sin_addr);
sport = ntohs(sin.sin_port);

con->channel = libssh2_channel_direct_tcpip_ex(con->session,
remote_desthost,remote_destport, shost, sport);
libssh2_session_set_blocking(con->session, 0);

struct conn c1;//own structure for connect
c1.hostname = "127.0.0.1";
c1.username = "root";
c1.password = "password";
c1.port = 2222;
struct conn *st1 = &c1;

init_sock(st1);
init_session(st1);

int x = libssh2_session_handshake(st1->session, st1->socket);
printf("handshake %i\n", x);

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-09-23