Subject: Re: [libssh2] going non-blocking

Re: [libssh2] going non-blocking

From: Daniel Stenberg <>
Date: Thu, 14 Dec 2006 10:42:00 +0100 (CET)

On Wed, 13 Dec 2006, Chris Nystrom wrote:

>> Nothing within libssh2 should ever hang waiting for network traffic in
>> either direction if the socket is set non-blocking.
> Yes, a blocking read was the only thing that worked for me, which was a
> problem, as my app is multi-threaded and I can not sit in there and wait for
> it.

There's also the problem of timeouts etc. When the interface is this blocking,
the only way to do timeouts with a reasonable resolution is to use signals -
which is very limiting.

> I tried writing a wrapper over libbsh2, but I needed
> libssh2_poll_channel_read() so I could know if there was data waiting to be
> read. I needed this before I went in with the blocking read, but this
> function does not seem to work for me (Filed bug 1588093).
> I never tried libssh2_poll(). Did you?

No I haven't tried that, but it's not an option for me.

I'm adding SSH-based transfers to an existing infrastructure that is already
using (possibly very many) sockets and poll()/select() etc so I'm quite
depending on that I can use the "standard" procedures to get to know about
socket activities and that the subsequent calls to deal with the data are

I don't see the point with libssh2_poll() at all, but then I'll willingly
admit that I'm not an libssh2 internals expert...

Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
libssh2-devel mailing list
Received on 2006-12-14