NSInputStream vs GCD's Dispatch Sources
NSInputStream vs GCD's Dispatch Sources
- Subject: NSInputStream vs GCD's Dispatch Sources
- From: Todd Heberlein <email@hidden>
- Date: Sun, 13 Oct 2013 15:18:29 -0700
I’m building a new Cocoa client app that will asynchronously receive data over a TCP connection from a server. I was reviewing my options, and I am a little uncertain.
On one hand there is the NSStream option (e.g., NSInputStream). It looks a moderately awkward setting up an initial connection (not as nice as NSURLConnection), and then it seems I schedule it on a run loop (probably the main run loop?).
On the other hand is the GCD Dispatch Sources. This appears to be pretty low level (C APIs as opposed to Objective C objects), but I get the feeling this (leveraging GCD in general) is the future. Lots of the WWDC talks over the last few years seem to stress getting IO off the main thread.
Is this a good interpretation?
That is, if starting with a fresh Cocoa app (no legacy code), would you recommend GCD’s Dispatch Source approach?
Thanks,
Todd
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden