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 (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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to