Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using C# i want to get download and upload usage of processes in bytes per seconds , How i must do this? for example an app how much is downloading or uploading right now.

What I have tried:

I did a lot research.
But i did't find anything for me.
Posted
Updated 7-Sep-17 11:25am

1 solution

You'll need to use a Performance Counter. See this CP article:

/ravi
 
Share this answer
 
Comments
Armin.Engineer 7-Sep-17 17:53pm    
Thanks , This is for retrieve network usage by process?
Ravi Bhavnani 7-Sep-17 17:55pm    
Yes. See this SO post for an example:

https://stackoverflow.com/questions/27396786/how-to-monitor-the-network-bandwidth-usage-of-a-specific-application

/ravi
Armin.Engineer 7-Sep-17 18:17pm    
Just copy and past but i get this error :
System.InvalidOperationException: 'Counter is single instance, instance name 'not found' is not valid for this counter category.'
Ravi Bhavnani 7-Sep-17 18:20pm    
So debug it and determine what's causing the problem. Blind copying and pasting is not the way to write code. If you have a specific question, we'll try to help you. But we're not here to do your work for you. CP is a volunteer site and we all have real jobs that occupy our time.

/ravi
Armin.Engineer 7-Sep-17 18:31pm    
i think u didn't understand well i did copy and paste and didn't touch the code and with this i wanted to prove that i didn't do any changes to get errors and its been a long time that trying to solve this problem , now i get this error (System.InvalidOperationException: 'Counter is single instance, instance name 'not found' is not valid for this counter category.) do you have any solution for solving this problem if test this code see that you get this error or not.

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