Re: Architecture for concurrent network client
Re: Architecture for concurrent network client
- Subject: Re: Architecture for concurrent network client
- From: Jens Alfke <email@hidden>
- Date: Mon, 21 Sep 2009 09:20:58 -0700
On Sep 20, 2009, at 8:43 AM, Sixten Otto wrote:
One way to approach this might be to create N threads, each of which
would "own" a connection, and wait on the request queue
You don't need concurrency or threads to handle socket connections.
The 'Mac way' is to use asynchronous I/O, hooking up the socket
connections to the runloop and getting callbacks when data is available.
Doing direct socket networking in Cocoa is a bit of a mess since there
aren't Objective-C APIs for everything you need to do, and the
callbacks can be unintuitive. Apple has a sample called CocoaEcho that
demonstrates it, and I wrote a little open-source framework called
MYNetwork that provides a higher-level abstraction.
—Jens_______________________________________________
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