开发者

NSURLConnection and keep-alive

I have a small bug in my client app that uses NSURLConnection. I have tracked it down to an unexpected connection keep-alive that seems to confuse the web server (probably a bug on the server side). The workaround would be to force-close all outstanding connections at a certain point. Can I do this somehow with NSURLConnection, i.e. something like

[NSURLConnection closeAllIdleConnections];开发者_C百科


ASIHTTPRequest has an expirePersistentConnections method. It may do what you're looking for.

It's not a drop-in replacement for NSURLConnection, but it's not too hard to port code from NSURLConnection to ASIHTTPRequest.


I think you might want to look at the following method defined for NSURLConnections. This assumes that you made the call asynchronously. If it isn't an async call, then it probably should be.

cancel Cancels an asynchronous load of a request.

  • (void)cancel

Discussion Once this method is called, the receiver’s delegate will no longer receive any messages for this NSURLConnection.

Hope this helps. Andrew.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜