Hello,

So I've run into a small problem with an application that I'm hoping someone can help me with. I apologize ahead of time, my code is crude at best still as I'm still learning.

The point of my application is to pick up all received packets and have it report to me not only what my current download speed is, but how much I have downloaded in the current session. That said this is where my problem comes in. I started a download that was roughly 93megs and had my monitor running at the same time and not only does the download speed not match what windows shows I am downloading at but the total downloaded packet count does not match up either. It's been frustrating because I'm either missing data or I'm simply not doing something right. The total download amount my application picks up shows roughly 70megs or so downloaded when in fact I downloaded 93.

I'm running Windows 7 x64 Professional
Visual Basic 2008

This is a copy of my code.

Below the class
HTML Code:
    Dim VarRecBefore As Integer
    Dim VarDeliverBefore As Integer
    Dim Flag As Boolean = False
Timer1
HTML Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles Timer1.Tick
        Dim VarRecAfter As Integer
        Dim VarCalcResult As Integer
        Dim VarDeliverAfter As Integer

        Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
        Dim ipstat As IPGlobalStatistics = properties.GetIPv4GlobalStatistics()

        VarDeliverAfter = ipstat.ReceivedPacketsDelivered
        VarRecAfter = ipstat.ReceivedPackets

        If Flag = True Then
            If VarRecAfter = VarRecBefore Then
                uxRecInfo.Text = "0"
            Else
                VarCalcResult = VarRecAfter - VarRecBefore
                uxRecInfo.Text = VarCalcResult & "kps"
                uxTotallbl.Text = VarCalcResult + uxTotallbl.Text
            End If
        Else
            Flag = True
        End If

        VarRecBefore = ipstat.ReceivedPackets()

        uxforwardlbl.Text = ipstat.ReceivedPacketsForwarded
        uxdeliverlbl.Text = ipstat.ReceivedPacketsDelivered
        uxdiscardedlbl.Text = ipstat.ReceivedPacketsDiscarded

    End Sub