cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: async socket help

From: john skaller <skaller_at_users.sourceforge.net>
Date: Wed, 3 Nov 2010 00:28:45 +1100

On 02/11/2010, at 8:19 PM, koettermarkus_at_gmx.de wrote:

> john skaller wrote:
>> Hi, I am wondering if any devs here would be willing
>> to help me figure out how to properly close an O_NONBLOCK socket.
>
> shutdown(socket, SHUT_RD);
> Once the socket is readable again, the outbuf should be flushed and you can close it.

I'm not quite sure I follow. If I shutdown for read, how can the socket ever
be readable again? How do I detect this (without blocking)? What has this
got to do with the output being flushed? Aren't the input and output
buffers independent?

Sorry, excuse my ignorance, I've actually heard something like this
before, it just doesn't seem to make sense and I don't recall where
this would be supported in the Posix standard.. ;(

The technique has to work on all platforms if possible (including Linux,
BSD, OSX, Windows and Solaris), although the details can differ
provided it can be wrapped.

[Again, sorry for asking here, just seemed like libcurl devs would be
some of the best people to ask.]

--
john skaller
skaller_at_users.sourceforge.net
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-02