• 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: CFNetwork with multiple persistent HTTP connections
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFNetwork with multiple persistent HTTP connections


  • Subject: Re: CFNetwork with multiple persistent HTTP connections
  • From: Mark Pauley <email@hidden>
  • Date: Thu, 16 Jul 2009 12:39:50 -0700

To effectively manage keepalive connections, you need to set a custom property on your readstream before opening, but after creation.

For example: if you set a property named 'ConnectionID' with a value that is some CFNumber i, and then do the same bug use j, and then do the same and again use i, the first and third streams will use the same connection if the persistence property is set _and_ you don't close the first stream before opening the second stream.

A bit complicated, but to be honest the functionality is a hack. We don't have an explicit notion of a connection to offer either HTTP Stream clients nor NSURLConnection clients. I'll consider building some better sample code for this if people deem it useful. Otherwise check out the ImageClient sample at developer.apple.com




On Jul 16, 2009, at 8:32 AM, Jens Alfke wrote:


On Jul 16, 2009, at 8:18 AM, Joe Ranieri wrote:

Would I create the streams via CFReadStreamCreateForHTTPRequest?

I think so. To be honest, I haven't used that particular API call before. When I have HTTP stuff to do, I just go up to NSURLConnection, which is usually much more convenient. (In your case, though, I don't think it's appropriate, because IIRC it doesn't give you control over how many actual TCP sockets get opened — I'm pretty sure it will just do what a typical browser does, opening a limited number (4?) of sockets.)


—Jens

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_Mark email@hidden




_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >CFNetwork with multiple persistent HTTP connections (From: Joe Ranieri <email@hidden>)
 >Re: CFNetwork with multiple persistent HTTP connections (From: Jens Alfke <email@hidden>)
 >Re: CFNetwork with multiple persistent HTTP connections (From: Joe Ranieri <email@hidden>)
 >Re: CFNetwork with multiple persistent HTTP connections (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: CFNetwork with multiple persistent HTTP connections
  • Next by Date: re: Crash in CFReadStreamOpen
  • Previous by thread: Re: CFNetwork with multiple persistent HTTP connections
  • Next by thread: re: Crash in CFReadStreamOpen
  • Index(es):
    • Date
    • Thread