• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Architecture for concurrent network client
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Architecture for concurrent network client
      • From: Sixten Otto <email@hidden>
References: 
 >Architecture for concurrent network client (From: Sixten Otto <email@hidden>)

  • Prev by Date: Re: Core Data memory not freed after reset
  • Next by Date: Re: Any way to tell why a window is closing?
  • Previous by thread: Architecture for concurrent network client
  • Next by thread: Re: Architecture for concurrent network client
  • Index(es):
    • Date
    • Thread