第一種
Dim host AsString="82.123.23.XX"' use any other machine nameDim pingreq As Ping =New Ping()Dim rep As PingReply = pingreq.Send(host )
Console.WriteLine("Pinging {0} [{1}]", host , rep.Address.ToString())
Console.WriteLine("Reply From {0} : time={1} TTL={2}", rep.Address.ToString(), rep.RoundtripTime, rep.Options.Ttl)
需要
Import
System.Net.NetworkInformation
第二種
PublicSharedFunction GetPingMs(ByRef hostNameOrAddress AsString)Dim ping AsNew System.Net.NetworkInformation.Ping Return ping.Send(hostNameOrAddress).RoundtripTime EndFunction GetPingMs("127.0.0.1") GetPingMs("www.dreamincode.net")
原始來源
全站熱搜