Re: Best practices for GCD-based socket I/O with SSL support?
Re: Best practices for GCD-based socket I/O with SSL support?
- Subject: Re: Best practices for GCD-based socket I/O with SSL support?
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Fri, 17 Apr 2015 09:51:29 +0100
On 13 Apr 2015, at 22:50, Jens Alfke <email@hidden> wrote:
> There’s probably an alternative way to run a listener/server socket, which could be scheduled on a dispatch queue, but I’m not too handy with BSD network APIs and I’ve never looked at dispatch_io. Anyone got any sample code or snippets?
There are two options here:
A. low-level -- Using BSD Sockets listen() and accept() with dispatch event sources to get the required async behaviour.
B. NSNetService -- On modern systems NSNetService can listen for incoming connections via the NSNetServiceListenForConnections flag.
Note that NSNetService does not currently support queue-based scheduling <rdar://problem/20584529>. Despite that, I'd still go with option B. Doing your own listening socket is not fun in the general case, and it's much easier to let the system take care of this for you.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden