简体   繁体   English

在iOS中,我们如何增加每个主机的HTTP连接限制?

[英]In iOS, how can we increase HTTP connection limit per host?

Using the Xcode networking tool, I analyzed that I am able to establish only 4 TCP connections per host at a time. 使用Xcode网络工具,我分析了我一次只能为每个主机建立4个TCP连接。 It seems iOS has a default TCP connection limit of 4 per host. 似乎iOS每个主机的默认TCP连接限制为4。

How can we increase that limit? 我们怎样才能增加这个限制?

EDIT : As stated by the OP this has changed in iOS 8: See Apple's documentation. 编辑 :正如OP所述,这在iOS 8中有所改变:请参阅Apple的文档。

Original post : 原帖

This is a limit in iOS you cannot change it. 这是iOS中的限制,您无法更改它。

See : On iOS URL Connection Parallelism and Thread Pools 请参阅: 在iOS URL连接并行和线程池上

I found a solution to this. 我找到了解决方案。 We can change the NSURLSession 's default settings such as HTTPMaximumConnectionsPerHost or ShouldUsePipelining by accessing [NSURLSessionConfiguration defaultSessionConfiguration] . 我们可以通过访问[NSURLSessionConfiguration defaultSessionConfiguration]来更改NSURLSession的默认设置,例如HTTPMaximumConnectionsPerHostShouldUsePipelining

[NSURLSessionConfiguration defaultSessionConfiguration].HTTPMaximumConnectionsPerHost = 10;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM