• 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 13:58:36 -0700


On Sep 21, 2009, at 10:14 AM, Sixten Otto wrote:

I don't think that that gets me out of the problem I was really trying
to ask about, though, which is how to manage getting the work from the
(single) queue of requests from the user to the exactly N persistent
connections available to the application. Somehow I need to track
which/how many connections are idle, and dequeue requests to those
connections.

Just keep a mutable array of free connections.
When a request arrives, and a connection is free, give it to the first free connection and remove the connection from the array.
Or if there aren't any free connections, add the request to a queue (another mutable array).
When a connection finishes its work, re-add it to the array, and if there are requests waiting in the queue, remove the oldest one and give it to the connection.


Do you have control over the protocol used by the server? There are more efficient ways to do this, like multiplexing multiple requests over a socket. (The BLIP protocol in MYNetwork does that; you can run any number of parallel messages over one socket at once.)

—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>)
 >Re: Architecture for concurrent network client (From: Jens Alfke <email@hidden>)
 >Re: Architecture for concurrent network client (From: Sixten Otto <email@hidden>)

  • Prev by Date: Re: Tablet events from ordinary touchpad?
  • Next by Date: Re: Why am I always getting the linker error: 'duplicate symbol'...?
  • Previous by thread: Re: Architecture for concurrent network client
  • Next by thread: Re: Architecture for concurrent network client
  • Index(es):
    • Date
    • Thread