This month's Index
Subject: libssh2 and select on multiple channels
libssh2 and select on multiple channels
From: sudheer kumar <sudheerkumar_m_at_ymail.com>
Date: Sun, 8 Jun 2014 05:16:27 +0800 (SGT)
I'm trying to write a event driven programming (written in perl through Net::SSH2 and EV) where if some data is available on socket I go over all the channels in non-blocking way to see if there is some data that can be read.
I'm seeing issues with above approach in some cases where socket is not shown as readable with select but when tried to read channel, it is available (I expected select to return before i did read on channel).
While browsing archives I found below one discussed back in 2010 with related topic:
Did anyone try other approach that works where select always says when something can be read from channel?
Does above approach work at all, as we have only one socket and multiple channels of it. And each read from channel should read from socket, and that is affecting select because if we have 'n' channels in a session, trying read on nth channel could have read data from socket which belongs to 1st channel and is stored in buffer and that affecting select to say socket is readable later?
Any leads on this topic if at all discussed before is greatly appreciated.