Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

Is it posible to get network traffic per application from the resource monitor ?

In example i see it on the network tab at windows but i need the information in a vb.net/C# program.


Thanks a lot !

Spec:

Windows 7 X86/X64
Posted

1 solution

System.Diagnostics.PerformanceCounterCategory and other related classes might be worth taking a look.
 
Share this answer
 
Comments
therookie007 12-Mar-12 4:39am    
but do you got examples ?

i think i need to get application name first and then loop trough the performance counters.

But i need to know how to get the performance counter per application to build that.
dan!sh 12-Mar-12 4:56am    
Check this article: http://www.codeproject.com/Articles/14598/Applications-Traffic-Watcher
therookie007 12-Mar-12 5:31am    
i see that he uses tcp stacks i need the performance counters and not the direct stacks:
This is my src with bandwith monitoring total but i need it from a single application like app.exe


Private Function GetTotalBW()


Dim pc As New PerformanceCounterCategory("Network Interface")
Dim instance As String = pc.GetInstanceNames(0)

Dim networkSent As New PerformanceCounter("Network Interface", "Bytes Sent/sec", instance)
Dim networkreceived As New PerformanceCounter("Network Interface", "Bytes Received/sec", instance)
Console.WriteLine("Monitoring " & instance)
Do
Dim kbSent As Integer = networkSent.NextValue() / 1024
Dim kbReceived As Integer = networkreceived.NextValue() / 1024


Dim MBSent As Integer = kbSent / 1024
Dim MBReceived As Integer = kbReceived / 1024




TotalBW.Text = "Sending:" & kbSent & " kb/s" & " - " & MBSent & "MB/S"
TOTALBS.Text = "Receiving: " & kbReceived & " kb/s" & " - " & MBReceived & "MB/S"
Application.DoEvents()
' MsgBox(tmpstring)
' Threading.Thread.Sleep(1000)
Loop
End Function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900