日期:2014-05-17  浏览次数:20954 次

如何实现ping命令 并能获取他的返回值
比如用windows的运行命令 ping www.163.com

能否取ping后的结果。。如下

Reply from 202.106.168.104: bytes=32 time=231ms TTL=49
Reply from 202.106.168.104: bytes=32 time=220ms TTL=49
Reply from 202.106.168.104: bytes=32 time=230ms TTL=49
Reply from 202.106.168.104: bytes=32 time=220ms TTL=49

Ping statistics for 202.106.168.104:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
Approximate round trip times in milli-seconds:
Minimum = 220ms, Maximum = 231ms, Average = 225ms

如何用api实现
求高手。。

------解决方案--------------------
使用 ProcessStartInfo 然后StreamReader 截取输出流 。。。。。
------解决方案--------------------
Process.Start(ping)
取OutputStream