NSURLConnection and keep-alive

I have a small error in my client application that uses NSURLConnection. I tracked it to an unexpected connection, which seems to be confusing the web server (probably a server-side error). A workaround would be to force close all outstanding connections at a certain point. Can I do this with NSURLConnection, i.e. Something like

[NSURLConnection closeAllIdleConnections];

+6
iphone cocoa-touch nsurlconnection keep-alive
source share
2 answers

ASIHTTPRequest has an expirePersistentConnections method. He can do what you seek.

This is not a replacement for NSURLConnection, but it is not too difficult to port the code from NSURLConnection to ASIHTTPRequest.

+1
source share

I think you can look at the following method specific to NSURLConnections. This assumes that you have made an asynchronous call. If this is not an asynchronous call, then this should probably be.

cancel Cancels an asynchronous load request.

  • (canceled) cancel

Discussion After calling this method, the recipient delegate will no longer receive any messages for this NSURLConnection.

Hope this helps. Andrew.

0
source share

All Articles