• 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: Overlapping requests on multiple persistent connections?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overlapping requests on multiple persistent connections?


  • Subject: Re: Overlapping requests on multiple persistent connections?
  • From: Michael Bernardo <email@hidden>
  • Date: Sat, 29 Nov 2008 12:29:33 -0500

Jim,

This is exactly what I was missing. Never occurred to me to add a custom property to the stream.

Thanks!

-M

On Nov 29, 2008, at 11:30 AM, Jim Luther wrote:

Mike,

I had the same problem with multiple persistent connections when I brought the WebDAV file system up on CFNetwork. The trick is to make each CFReadStream unique so that CFNetwork's connection cache won't try to queue up your new request on a persistent connection it already has open. This is pretty easy -- just create a unique CFString (or number) value for each persistent connection you want and then set that value as a property on the CFReadStream after you create it but before you open it. For example:

newReadStreamRef = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request);
/* add persistent property */
CFReadStreamSetProperty(newReadStreamRef, kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
/* make the read stream unique */
CFReadStreamSetProperty(newReadStreamRef, CFSTR("UniqueProperty"), uniqueValue);


- Jim

On Nov 28, 2008, at 7:58 AM, Michael Bernardo wrote:


I'm trying to use the CFNetwork APIs to make multiple simultaneous HTTP POST requests to a web service using persistent connections.


I've followed the model used by sample code at "/Developer/Examples/ Networking/Get Example" to get a single persistent connection working. I can verify that with single, serial requests, the connection is re-used.

The trouble starts when I try to send simultaneous overlapping requests. It seems that CFNetwork only creates a single underlying network connection, no matter how many simultaneous requests are outstanding.

Is this expected behavior? Is there any way to get multiple persistent connections created?

TIA,
Mike Bernardo



_______________________________________________
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


_______________________________________________ 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: 
 >Overlapping requests on multiple persistent connections? (From: Michael Bernardo <email@hidden>)
 >Re: Overlapping requests on multiple persistent connections? (From: Jim Luther <email@hidden>)

  • Prev by Date: Re: Overlapping requests on multiple persistent connections?
  • Previous by thread: Re: Overlapping requests on multiple persistent connections?
  • Index(es):
    • Date
    • Thread