我想在 ping 主机后获取 ping 执行时间和结果字符串
我想在 ping 主机后获取 ping 执行时间和结果字符串。我该怎么做呢?
I want to get the ping execution time and result in string after ping host. How can I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
但这只会在Windows系统中使用ICMP ping。
But this will use ICMP ping only in windows system.
你检查过了吗
http://docs.oracle.com/javase /1.4.2/docs/guide/nio/example/Ping.java
和
http://www.java2s.com/Code/JavaAPI/java.net/InetAddressReachableinttimeout .htm
did you check this
http://docs.oracle.com/javase/1.4.2/docs/guide/nio/example/Ping.java
and
http://www.java2s.com/Code/JavaAPI/java.net/InetAddressisReachableinttimeout.htm
这就是我使用它的方式 -
为您提供每个 ping 请求的精确(可靠)ping 延迟(以毫秒为单位)。
如果需要,您可以添加其中的四个
This is how I used it -
Gives you the exact (reliable) ping latency in milliseconds for each ping request.
You can then add the four of them, if required