Overcoming max persistent connections with different ports?

旧巷老猫 提交于 2019-12-01 21:02:04

问题


Following on from Max parallel http connections in a browser?, browsers can only have a few connections per host. I know this can be worked around using subdomains, but can I get around this by using different ports for the same host?

So would the following allow a browser to triple its connections (assuming something was listening on each port)?

www.example.com
www.example.com:8080
www.example.com:8081

Thanks


回答1:


Yes, using a different port number will cause the browser to treat it as a different host, just like using a subdomain. I have not been able to find an authoritative source on how this should work, but the behavior is clearly demonstrable in current browsers. See Firebug and Chrome Dev tools screenshots below for loading a bunch of images.

The only different between the two is having all images point to the same port number:

<img src="http://localhost:8001/IMG_0277.JPG"><br>
....

Or having them point to a mixture of ports

<img src="http://localhost:8001/IMG_0277.JPG"><br>
<img src="http://localhost:8002/IMG_0278.JPG"><br>
<img src="http://localhost:8003/IMG_0279.JPG"><br>
....



来源:https://stackoverflow.com/questions/16283776/overcoming-max-persistent-connections-with-different-ports

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