问题描述
目标:获取服务器的外部 IP 地址列表.执行 ping 以测试延迟.就像在 CMD 中一样,ping 命令显示平均延迟.但是在 Visual Studio 中,我发现 ping 仅作为连接到服务器的布尔值.我如何测试服务器的延迟以在 vb.net 中找到可能的最快连接?除了 ping 之外,我找不到任何其他方法来执行 ping 操作.my.computer.network.ping(192.168.1.1)
.那么有没有另一种方法可以在 vb.net 中完成延迟测试?谢谢!
Goal: take a list of servers' external ip address. perform a ping to test latency. Like in CMD the ping command shows an average latency. But in visual studio I found the ping only as Boolean for connectivity to a server. How might I go about testing latency to a server to find the fastest connection possible in vb.net? I can't find any other way to do a ping other than. my.computer.network.ping(192.168.1.1)
. So is there another way to accomplish a latency test in vb.net? Thanks!
技能等级:接近初学者
推荐答案
这里有 VB.NET 的 ping 示例
Here you have a ping example for VB.NET
Dim host As String = "82.123.23.XX" ' use any other machine name
Dim 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)
您需要导入
System.Net.NetworkInformation
这篇关于使用 VB.NET 测试网络延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!