[libdispatch-dev] dispatch source for multi-client sockets
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...
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
>> 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 ?
> -- Jean-Daniel
> libdispatch-dev mailing list
> libdispatch-dev at lists.macosforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libdispatch-dev