Subject: Re: libssh2_poll()

Re: libssh2_poll()

From: Peter Stuge <peter_at_stuge.se>
Date: Fri, 18 Jun 2010 08:34:46 +0200

Please STOP replying to messages when you want to create a new
thread. This causes problems for search engines and humans who use
threading as a means to organize related messages as a whole
discussion in their email software. When you are creating a new topic
make sure to send a new email, or at the very least make sure that
you remove any RFC822 headers in your message that link it to
previous posts. (This is not possible in many email programs, so the
safe method is to always send a new email when starting a new topic!)

Thomas Stover wrote:
> If input is available on the session's socket, how do you figure out
> which channels now have input that needs to be read?
> libssh2_channel_read() every one?

Yes, and you must be using non-blocking. This is a known deficiency
in the libssh2 API that is being worked on.

> Also what if these bytes coming in from the socket are not for a
> channel at all?

Then they all return _EAGAIN.

> how would one tell the session that now is the time to read from
> the socket?

By reading from any channel the library will try to read from the
socket associated with the session that the channel belongs to. If
there's data to be read then it ends up on the right channel.

> Does this just happen behind the scenes when polling each channel?

If by polling you mean _channel_read() then yes.

> What if there are no channels?

Then there won't be much data. This case isn't covered at all by the
current API. It's an important point to keep in mind for the future
improvements.

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