[libdispatch-dev] dispatch source for multi-client sockets
Shantonu Sen
ssen at apple.com
Tue Sep 22 06:09:19 PDT 2009
Since the event sources are built in kqueues, a listen's sockets read
event indicates a pending connection.
Another example is <http://www.opensource.apple.com/source/libdispatch/libdispatch-84.5.1/examples/Dispatch%20Samples/netcat.c
>
Note that this example, by design, suspends the listening queue to
prevent new connections from being accepted in parallel, but you would
want to remove that restriction...
Shantonu
Sent from my MacBook
On Sep 22, 2009, at 3:49 AM, Jean-Daniel Dupas wrote:
>
> Le 22 sept. 2009 à 12:15, Mikkel Fahnøe Jørgensen a écrit :
>
>> How does one create a dispatch source that responds to multiple
>> connections on the same socket, that is, listening on a socket with a
>> backlog larger than 1?
>>
>> In the online doc it seems that you should have a connected socket to
>> read from, the same way as reading from a file. But documentation
>> also
>> says you need a socket returned from listen().
>>
>> So where does the accept() call fit into this? Specifically it would
>> be nice to avoid blocking on accept() before creating a read source.
>>
>
> You mean, like a Web server ?
>
> http://developer.apple.com/mac/library/samplecode/DispatchWebServer/index.html
>
>>
>
> -- Jean-Daniel
>
>
>
>
> _______________________________________________
> libdispatch-dev mailing list
> libdispatch-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-dev/attachments/20090922/fde35730/attachment.html>
More information about the libdispatch-dev
mailing list