用Java进行网速测试
命令格式:
ping ip地址 -l 字节数
注:上面的命令中 l 是字母l,不是数字
1
网速等于≈(发送的字节数/返回的时间[毫秒])K字节
以上计算的结果速为字节(
byte
),不是我们通常说的位(bps)
如:
C:Documents and SettingsAdministrator>ping
202.101
.
224.68
-l
1000
Pinging
202.101
.
224.68
with
1000
bytes of data:
Reply from
202.101
.
224.68
: bytes=
1000
time=38ms TTL=
251
Reply from
202.101
.
224.68
: bytes=
1000
time=38ms TTL=
251
Reply from
202.101
.
224.68
: bytes=
1000
time=38ms TTL=
251
Reply from
202.101
.
224.68
: bytes=
1000
time=38ms TTL=
251
Ping statistics
for
202.101
.
224.68
:
Packets: Sent =
4
, Received =
4
, Lost =
0
(
0
% loss),
Approximate round trip times in milli-seconds:
Minimum = 38ms, Maximum = 38ms, Average = 38ms
根据上述发送及返回的信息可以简单得出到地址
202.101
.
224.68
的网速为:
网速等于≈(发送的字节数/返回的时间[毫秒])K字节
≈
1000
/38K字节
≈
26
.32K字节
附:ping命令帮助说明
-l size Send buffer size
-w timeout Timeout in milliseconds to wait
for
each reply.
-n count Number of echo requests to send.
-----------------------------------------