Delay Nework test with VB.NET

Purpose: to take a list of external IP addresses of servers. ping to check the delay. As in CMD, the ping command shows the average delay. But in visual studio, I found ping only as a Boolean to connect to the server. How can I test the delay on the server to find the fastest connection in vb.net? I can not find any other way to ping than. my.computer.network.ping(192.168.1.1) . So, is there another way to run a latency test in vb.net? Thanks!

Skill Level: Close to Absolute Beginner

+4
source share
3 answers

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) 

You will need to import

System.Net.NetworkInformation

+6
source
 Public Shared Function GetPingMs(ByRef hostNameOrAddress As String) Dim ping As New System.Net.NetworkInformation.Ping Return ping.Send(hostNameOrAddress).RoundtripTime End Function GetPingMs("127.0.0.1") GetPingMs("www.dreamincode.net") 

Source: http://www.dreamincode.net/code/snippet1511.htm

+2
source

Just write this code at the click of a button, you don’t need to import anything.

 Dim IP As String = InputBox("Enter Client IP", "Ping To Client") Shell("CMD.exe /C ping " & IP & " -t", AppWinStyle.NormalFocus) 
0
source

Source: https://habr.com/ru/post/1446279/


All Articles