Foro de elhacker.net

Programación => .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
  1.  Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) _
  2.    Handles Timer1.Tick
  3.        Dim nics As System.Net.NetworkInformation.NetworkInterface()
  4.        nics = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
  5.  
  6.        For Each nic As NetworkInterface In nics
  7.            Dim S As Integer = nic.NetworkInterfaceType
  8.  
  9.            If nic.OperationalStatus = 1 Then
  10.                If S = NetworkInterfaceType.Wireless80211 Or S = NetworkInterfaceType.Ethernet Then
  11.                    Dim ipv4Stats As System.Net.NetworkInformation.IPv4InterfaceStatistics
  12.                    ipv4Stats = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces.First.GetIPv4Statistics
  13.                    Label1.Text = String.Format("Enviado: {0} bytes", ipv4Stats.BytesSent.ToString("##,##"))
  14.                    Label2.Text = String.Format("Recibido: {0} bytes", ipv4Stats.BytesReceived.ToString("##,##"))
  15.  
  16.                End If
  17.                If S = NetworkInterfaceType.Ppp Then
  18.                    Dim ipv4Stats As System.Net.NetworkInformation.IPv4InterfaceStatistics
  19.                    ipv4Stats = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(1).GetIPv4Statistics
  20.                    Label1.Text = String.Format("Enviado: {0} bytes", ipv4Stats.BytesSent.ToString("##,##"))
  21.                    Label2.Text = String.Format("Recibido: {0} bytes", ipv4Stats.BytesReceived.ToString("##,##"))
  22.                End If
  23.            End If
  24.        Next
  25.    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