Re: NSInputStream vs GCD's Dispatch Sources
Re: NSInputStream vs GCD's Dispatch Sources
- Subject: Re: NSInputStream vs GCD's Dispatch Sources
- From: Marcelo Alves <email@hidden>
- Date: Sun, 13 Oct 2013 20:10:28 -0300
Check the CGDAsyncSocket project.
--
:: marcelo.alves
> On 13/10/2013, at 19:18, Todd Heberlein <email@hidden> wrote:
>
> 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
_______________________________________________
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