Ping and detecting loss

Hi,

I've looked through the ping class and was wondering if there is way to determine the packets sent and received (packet loss)

Thanks in advance!



Answer this question

Ping and detecting loss

  • Osmar

    Well, yes... Just run the Ping.Send() n times and check its response...

    Private Sub pingHost(ByVal source As String, ByVal numOfPackages As Integer)

    Dim p As New System.Net.NetworkInformation.Ping()

    Dim pReply As System.Net.NetworkInformation.PingReply

    Dim validPackages, invalidPackages As Integer

    For index As Integer = 1 To numOfPackages

    pReply = p.Send(source)

    If (pReply.Status = Net.NetworkInformation.IPStatus.Success) Then

    validPackages = +1

    End If

    Next

    invalidPackages = numOfPackages - validPackages

    End Sub


  • Ping and detecting loss