On Oct 13, 2013, at 3:18 PM, Todd Heberlein <todd_heberl...@mac.com> wrote:
> 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?). You’re right, it is awkward to set up. In particular, to avoid using the deprecated NSHost class, you should create the streams by calling CFStreamCreatePairWithSocketToHost — this creates CFStreams, which are toll-free bridged to NSStreams. You can schedule it on any runloop you want. Using the main runloop is convenient, and probably OK if your callbacks don’t take very long to run. Otherwise you can create a new NSThread and start it up on that. > On the other hand is the GCD Dispatch Sources. Here I agree with Marcelo that GCDAsyncSocket is the way to go. The only downside is that there’s more API to learn, and you’re adding a dependency on a 3rd party (open source) library. But it’s a lot more modern and capable than the creaky NSStream stuff. —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com