Taken from libssh api documentation : 
http://api.libssh.org/master/libssh_tutor_threads.html
"At all times, you may use different sessions inside threads, make parallel 
connections, read/write on different sessions and so on. You cannot use a 
single session (or channels for a single session) in several threads at the 
same time. This will most likely lead to internal state corruption. This 
limitation is being worked out and will maybe disappear later."
I'm wondering how to implement the "parallel connections, read/write on 
different sessions and so on". I experimented on this in my application but not 
successful. What I did is to create 2 new sessions, and within each session I 
created a channel. So 1 session is using ssh_channel_write while the other is 
using ssh_channel_read. But I realized that this is totally 2 different 
sessions so there's no way both sessions can communicate. What I'm doing is a 
simple terminal application that will connect to a unix server via ssh 
connection. The application has 2 threads, 1 thread is constantly reading if 
there's available message in the socket while the other thread is writing to 
the channel. Since it is forbidden to uses single session I used 2 instead 
(which is stupid but I have to try.)
Any help will be appreciated.
Regards,
Mark Anthony

<<attachment: winmail.dat>>

Reply via email to