On Fri, 18 Sep 2009, Peter Stuge wrote:

Right, which is why I'm asking this question. When thinking about it a bit, I can't see a compelling argument for combining nbio with the use of select() - on the contrary it seems to require some tricky extra effort.

You're basically basing that assumption on that recv() and send() will return and behave identically if it was blocking.

And if they would return immediately in blocking mode as it does in non-blocking mode, they would behave the same as the code does now and we would gain nothing by switching!

But the reality is that blocking sockets do in fact cause send(), recv() and friends to block at times when non-blocking don't and that's the reason. Let me for example quote a little piece from the send() man page:

    When  the  message  does  not  fit  into the send buffer of the socket,
    send() normally blocks, unless the socket has been placed in non-block‐
    ing I/O mode.

--

 / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to