我正在尝试发送ping数秒,而不是一定数量的ping并收集结果。我注意到,如果我进入并运行" ping www.google.com"并使用CTRL + C停止它不会打印统计信息,但如果我运行" ping -c5 www.google.com"统计数据将打印出来。有没有办法发送ping命令,让它在指定的时间后超时,然后打印ping统计信息?
注意:我是用Java编程发送的。
C:\Users\Field_Test>adb shell
shell@android:/ $ ping www.google.com
ping www.google.com
PING www.google.com (173.194.46.116) 56(84) bytes of data.
64 bytes from ord08s13-in-f20.1e100.net (173.194.46.116): icmp_seq=1 ttl=54 time
=55.7 ms
64 bytes from ord08s13-in-f20.1e100.net (173.194.46.116): icmp_seq=2 ttl=54 time
=70.9 ms
64 bytes from ord08s13-in-f20.1e100.net (173.194.46.116): icmp_seq=3 ttl=54 time
=60.8 ms
64 bytes from ord08s13-in-f20.1e100.net (173.194.46.116): icmp_seq=4 ttl=54 time
=71.1 ms
64 bytes from ord08s13-in-f20.1e100.net (173.194.46.116): icmp_seq=5 ttl=54 time
=69.8 ms
64 bytes from ord08s13-in-f20.1e100.net (173.194.46.116): icmp_seq=6 ttl=54 time
=72.0 ms
^C
答案 0 :(得分:1)
nm,找到了它。 " -w#"将运行指定的时间并打印统计信息。