Reset connection using peer to peer with iPhone NSURLConnection
I am trying to connect to a C # HTTP server with an iPhone app. Pretty simple code:
NSData *requestData = [ NSData dataWithBytes: [ requestMessage UTF8String ] length: [ requestMessage length ] ];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:infoURL]];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[request setHTTPMethod: @"POST"];
[request setHTTPBody: requestData];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
The server receives the request, sends a response, and then terminates the connection. The iPhone reports a peer-to-peer reset connection.
To be able to hit the server in Firefox on my desktop, I need to go to its advanced prefs and disable support. The reason, I suppose, is because I terminate the connection immediately after the response is sent. I do this because I don't want to reuse connections later.
Is there anyway to disable keep-alive when using NSURLConnection on iPhone, or any suggestions for changing my .Net code?
0
a source to share