Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
NSMutableURLRequest: Keeping the connection open
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableURLRequest: Keeping the connection open



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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.