• 0

[VB .NET] bytes sent & rec


Question

i tired of trying, but i can't figure this out...

i have a performancecounter and i want to get bytes sent and received in the internet connection

the categoryname is ip and the countername is Datagrams Received/sec but this isn't what i want...

total=total + performancecounter.NextValue

Link to comment
https://www.neowin.net/forum/topic/105579-vb-net-bytes-sent-rec/
Share on other sites

4 answers to this question

Recommended Posts

  • 0

...

sorry... i just found the problem, i had to choose the connection...

how to determine the internet connection automaticly? i have 3 connections and i don't want any of the others, just the net.

i need to know how to determine it in other computers...

(sorry for my english....)

  • 0
Dim pccat As PerformanceCounterCategory = New PerformanceCounterCategory("Network Interface")
Dim catNames(pccat.GetInstanceNames.Length) As String
catNames = pccat.GetInstanceNames()

Dim msg As String = ""

For i As Integer = 0 To catNames.Length - 1
 ? Dim pc As PerformanceCounter = New PerformanceCounter
 ? pc.CategoryName = "Network Interface"
 ? pc.CounterName = "Bytes Received/sec"
 ? pc.InstanceName = catNames(i)
 ? pc.NextValue()
 ? System.Threading.Thread.Sleep(1000)
 ? msg = msg & catNames(i) & ": " & pc.NextValue.ToString() & vbCrLf
Next

MessageBox.Show(msg)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.