PING an ip address and get the response time

Posted in: General vb.NET
By dePoPo
Mar 16, 2009 - 9:59:25 AM



        ' --- ping the ip adress in the string s_ipaddr, and get
        '     the response time in the int32 n_response
        ' imports system.net.networkinformation
        Dim ping As New System.Net.NetworkInformation.Ping
        Dim reply As System.Net.NetworkInformation.PingReply
        reply = ping.Send(s_ipaddr)
        If reply.Status = IPStatus.Success Then
            ' --- handle reachable here
            MsgBox("ping time " & reply.RoundtripTime)
        Else
            ' --- handle non reachable here
        End If


Visitor Comments