Subject: Re: About libssh2_channel_read

Re: About libssh2_channel_read

From: Peter Stuge <peter_at_stuge.se>
Date: Tue, 9 Mar 2010 15:10:22 +0100

sebastien isquierdo wrote:
> I'm trying now to make 2 or more connections to MySQL through SSH.
..

> - create a non-blocking session (libssh2_session_init, )

Good, this is important.

> - for each socket write on the good channel (libssh2_channel_write)
> - and listen to the good channel to (libssh2_channel_read)
>
> I make a new thread for reading on every channel.

Note that libssh2 is not at all thread safe. You need a global mutex
for the entire session until libssh2_channel_write() or
libssh2_channel_read() has transfered the full data you want to
transfer.

> My problem is libssh2_channel_read returns informations only from
> on the last created channel and nothing from the others.

Please send a libssh2 debug log from establishing one connection,
passing data, then establishing a second connection, and trying to
pass data, in that order.

Let's see if we can spot the problem.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-09