Maximum number of concurrent NSURLConnections to the same host?

你离开我真会死。 提交于 2019-12-01 03:59:33

I filed a Radar for something that seems like the same issue but on iOS. I found that you can't have more than 5 connections open at once. The connections don't have to be pointing to the same domain. Anything after that would be queued. So if you have 5 connections open to an extremely slow endpoint, any other connections will not go through.

Radar: http://openradar.appspot.com/radar?id=2542401

Apple's reply:

This is the effect of our NSURLConnection connection cache. It is expected. We expect to address this type of configuration with new API.

I asked if they could give me anymore information (does it vary? does the type of connection affect it?) and they said:

Unfortunately, we can't give details about the connection limit behavior.

User agents in general (Chrome, Firefox, Safari) use six simultaneous TCP connections per hostname, with potential one-offs.

You could break this limitation by using CFNetwork API (CFHTTPMessage).

Here is the CFNetwork Programming Guide. https://developer.apple.com/library/mac/documentation/Networking/Conceptual/CFNetwork/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001132

BTW, if you decide to use CFNetwork, you'll need to work around the proxy and authenticate.

Wish this could helped!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!