我观察过多次,访问我的www.mycisco.cn 总能看到10个连接
TCP 192.168.0.185:3632 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3633 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3634 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3635 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3636 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3637 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3638 203.171.232.42:80 ESTABLISHED
TCP 192.168.0.185:3639 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3640 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3641 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3642 125.76.229.121:80 ESTABLISHED
这就让我迷惑。今天在网上一番google,终于明白了点:
原来根据RF2616的要求,客户端和同一个server之间确实只能建立不超过2个TCP(http 1.1是2个,1.0是4个连接)连接以避免拥塞
Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.
但是这个不是绝对的,不同的浏览器行为可能并不一样。对于IE有这样一个注册表设置:
MaxConnectionsPerServer REG_DWORD (Default 2)
Sets the number of simultaneous requests to a single HTTP 1.1 Server
MaxConnectionsPer1_0Server REG_DWORD (Default 4)
Sets the number of simultaneous requests to a single HTTP 1.0 Server
这是标准的,但是我的电脑是IE7,他们的值都是10
我查了微软的文档,http://support.microsoft.com/kb/183110/en-us,6.0(含)以前的版本应该都是2. 大家可以验证下。
我将限制值改为2后,再查看发现确实只能同时建立2个TCP连接了。
Proto Local Address Foreign Address State
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:2869 0.0.0.0:0 LISTENING
TCP 0.0.0.0:15000 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1045 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1100 0.0.0.0:0 LISTENING
TCP 127.0.0.1:62514 0.0.0.0:0 LISTENING
TCP 192.168.0.185:139 0.0.0.0:0 LISTENING
TCP 192.168.0.185:1071 219.133.60.243:8000 CLOSE_WAIT
TCP 192.168.0.185:2307 121.0.19.146:16000 ESTABLISHED
TCP 192.168.0.185:3609 60.28.183.195:80 TIME_WAIT
TCP 192.168.0.185:3615 60.28.183.195:80 TIME_WAIT
TCP 192.168.0.185:3618 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3619 125.76.229.121:80 ESTABLISHED
TCP 192.168.0.185:3620 203.171.232.42:80 ESTABLISHED
TCP 192.168.0.185:3621 125.46.105.130:80 ESTABLISHED
TCP 192.168.0.185:3623 60.12.231.25:80 ESTABLISHED
TCP 192.168.0.185:3624 60.12.231.15:80 ESTABLISHED
TCP 192.168.0.185:3625 61.189.20.200:80 SYN_SENT
TCP 192.168.0.185:4952 207.46.107.64:1863 ESTABLISHED
TCP 192.168.0.185:4989 207.46.26.130:1863 ESTABLISHED
TCP 192.168.0.185:4990 64.4.36.22:1863 ESTABLISHED
TCP 192.168.0.185:4991 207.46.26.76:1863 ESTABLISHED
TCP 192.168.0.185:4992 65.54.171.33:1863 ESTABLISHED
TCP 192.168.0.185:4993 65.54.171.39:1863 ESTABLISHED
TCP 192.168.0.185:4995 207.46.26.153:1863 ESTABLISHED
TCP 192.168.124.1:139 0.0.0.0:0 LISTENING
TCP 192.168.194.1:139 0.0.0.0:0 LISTENING
相关文章http://blog.joycode.com/musicland/archive/2005/04/16/48690.aspx
http://blogs.msdn.com/ie/archive/2005/04/11/407189.aspx
http://support.microsoft.com/kb/1
83110/en-us
&nbs
p;
文章评论
最近看了一本书,终于明白这2个到底指得是什么,是指对同一个域名下的组件内容,同时并行两个下载,例如有6个图片,需要分3次并行下载完。
当下载脚本时,浏览器不行并行,必须等待脚本下载完才能继续执行后面组件下载
用多域名映射到同一个IP可以欺骗浏览器
学习了