同一主机的最大并发NSURLConnections数量

同一主机的最大并发NSURLConnections数量

本文介绍了同一主机的最大并发NSURLConnections数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行一个OS X应用程序中的问题,使用NSURLConnection创建到同一主机的多个持久连接。我为不同的房间创建一个单独的连接,它保持连接在整个时间的房间是开放使用流API。当打开许多房间时,它停止正常工作。



我创建了一个单独的示例应用程序,创建10个连接,它似乎只允许6个连接工作,其他排队。有谁知道是否有一种方法来覆盖这个限制?我找不到它记录在任何地方。我发现的唯一解决方法是它似乎是每个主机名,因此使用localhost和127.0.0.1测试允许每个主机6个连接。我在此处向客户和服务器上传了一个示例项目 - 。

解决方案

我提交了一个雷达的东西看起来像同样的问题,但在iOS上。我发现你不能有超过5个连接一次打开。连接不必指向同一个域。之后的任何内容都将排队。因此,如果您有5个连接打开到极其缓慢的端点,则任何其他连接都不会通过。



雷达:



Apple's回复:

我问他们是否可以给我更多信息连接类型会影响它吗?),他们说:


I'm running in to an issue in an OS X app that creates multiple, persistent connections to the same host using NSURLConnection. I create a separate connection for different rooms, and it stays connected the entire time the room is open to consume a streaming API. When opening many rooms, it stops working correctly.

I created a separate sample app that creates 10 connections, and it seems to only allow 6 connections to work, and the others are queued. Does anyone know if there is a way to override this limit? I can't find it documented anywhere. The only workaround I've found is it seems to be per host name, so testing with "localhost" and "127.0.0.1" allows 6 connections per host. I uploaded a sample project with client and server here - http://cl.ly/1x3K0D1F072V3U2T0C0I.

解决方案

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:

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

这篇关于同一主机的最大并发NSURLConnections数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 23:19