Test Foro de elhacker.net SMF 2.1

Programación => Programación General => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: Lekim en 4 Noviembre 2015, 12:40 PM

Título: los bytes de datos enviados y recibidos de la red mediante VB.NET no cuadran.
Publicado por: Lekim en 4 Noviembre 2015, 12:40 PM
Hola

Mediante este código obtengo los bytes enviados y recibidos por la red.

Código (vbnet) [Seleccionar]
 Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) _
   Handles Timer1.Tick
       Dim nics As System.Net.NetworkInformation.NetworkInterface()
       nics = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()

       For Each nic As NetworkInterface In nics
           Dim S As Integer = nic.NetworkInterfaceType
 
           If nic.OperationalStatus = 1 Then
               If S = NetworkInterfaceType.Wireless80211 Or S = NetworkInterfaceType.Ethernet Then
                   Dim ipv4Stats As System.Net.NetworkInformation.IPv4InterfaceStatistics
                   ipv4Stats = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces.First.GetIPv4Statistics
                   Label1.Text = String.Format("Enviado: {0} bytes", ipv4Stats.BytesSent.ToString("##,##"))
                   Label2.Text = String.Format("Recibido: {0} bytes", ipv4Stats.BytesReceived.ToString("##,##"))

               End If
               If S = NetworkInterfaceType.Ppp Then
                   Dim ipv4Stats As System.Net.NetworkInformation.IPv4InterfaceStatistics
                   ipv4Stats = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(1).GetIPv4Statistics
                   Label1.Text = String.Format("Enviado: {0} bytes", ipv4Stats.BytesSent.ToString("##,##"))
                   Label2.Text = String.Format("Recibido: {0} bytes", ipv4Stats.BytesReceived.ToString("##,##"))
               End If
           End If
       Next
   End Sub




Pero no cuadra con los mostrados por Windows a través del cuadro "Estado de Conexión de red inalámbrica":


(http://1.bp.blogspot.com/-94FpMhwvXyg/VjnzQq8dQcI/AAAAAAAAATI/FFXJErvKZU0/s320/bytes.jpg)


Gracias