Subject: Re: [libssh2] going non-blocking

Re: [libssh2] going non-blocking

From: Daniel Stenberg <daniel_at_haxx.se>
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
non-blocking.

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 SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2006-12-14