• 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
NSMutableURLRequest: Keeping the connection open
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableURLRequest: Keeping the connection open


  • Subject: NSMutableURLRequest: Keeping the connection open
  • From: Thomas Engelmeier <email@hidden>
  • Date: Wed, 30 Mar 2011 18:15:11 +0200

Hi,

I´m trying to prevent NSMutableURLRequest / NSURLConnection from closing an connection after roughly  2 secs.
When within these two secs another request happens, the SSL connection stays open for another 2 secs.

Is there a way to access the the underlying stream? Or pass through an keep alive parameter?
I'd try to avoid rewriting the networking code with custom CFStream based HTTP client implementation

The connection code is something like

	NSMutableURLRequest* request =
[NSMutableURLRequest requestWithURL:fullURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData  timeoutInterval:90.]
	[request setHTTPMethod:aMethod];
	NSData* data = [self requestBodyForObject:anObject];
	[request setHTTPBody:data];

// code deleted

	if( !connection ) {
		connection = [[NSURLConnection alloc] initWithRequest:aRequest delegate:self startImmediately:NO];
		[connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
		[connection start];
        }

Things I tried:
- Playing a lot with an debug proxy (Charles), our code and SimpleURLConnections
- defer release of the NSURLConnection of the request until the next request gets created
- play with HTTP keep alive headers
- connect against different https:// websites

TIA,
	Thomas _______________________________________________
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

  • Follow-Ups:
    • Re: NSMutableURLRequest: Keeping the connection open
      • From: Mark Pauley <email@hidden>
    • Re: NSMutableURLRequest: Keeping the connection open
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Prev by Date: Re: Uploading to FaceBook, etc.
  • Next by Date: Re: NSMutableURLRequest: Keeping the connection open
  • Previous by thread: Re: Uploading to FaceBook, etc.
  • Next by thread: Re: NSMutableURLRequest: Keeping the connection open
  • Index(es):
    • Date
    • Thread