使用JS模拟系统ping命令
JS虽然发送不了真正Ping的ICMP数据包,但ping的本质仍然是请求/回复的时间差,HTTP自然可以实现此功能。当然,在请求时无法统计HTTP头部的长度,所以当请求数据包长度在最大传输单元临界点时,额外的HTTP头可以导致IP分组,因此存在一定的误差。
以下是一个示例:
转载请以超链接注明来自 云在天边看世界本文永久链接 http://www.tangblog.info/2011/03/15/js-ping.html
JS虽然发送不了真正Ping的ICMP数据包,但ping的本质仍然是请求/回复的时间差,HTTP自然可以实现此功能。当然,在请求时无法统计HTTP头部的长度,所以当请求数据包长度在最大传输单元临界点时,额外的HTTP头可以导致IP分组,因此存在一定的误差。
以下是一个示例:
转载请以超链接注明来自 云在天边看世界
谢谢,之前一直搞不定的就是奇偶问题
可以这样写:
btw:请问一下,阁下的友链是怎么分成两栏显示的?
我的那部分代码是:
{%for link in blogroll%} <li><a href="{{link.href}}" target="_blank">{{link.linktext}}</a></li> {%endfor%}
我不知道如何将这些东西放到两个ul上,就是不知道如何把link选成两类,能提示一下或者给我这段代码么,thanks
我这里倒是可以返回时间的。。
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from http://gary-blog.com time=3256ms
Reply from http://gary-blog.com time=845ms
Reply from http://gary-blog.com time=823ms
Reply from http://gary-blog.com time=825ms
Reply from http://gary-blog.com time=846ms
Reply from http://gary-blog.com time=2025ms
Reply from http://gary-blog.com time=1113ms
Reply from http://gary-blog.com time=860ms
Reply from http://gary-blog.com time=835ms
Reply from http://gary-blog.com time=1959ms
Reply from http://gary-blog.com time=1101ms
Reply from http://gary-blog.com time=845ms
Reply from http://gary-blog.com time=803ms
Reply from http://gary-blog.com time=826ms
Reply from http://gary-blog.com time=864ms
Reply from http://gary-blog.com time=820ms
Reply from http://gary-blog.com time=834ms
Ping statistics for http://gary-blog.com:
Packets: Sent = 17, Received = 17, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 803ms, Maximum = 3256ms, Average = 1145ms
貌似比较不稳定