Internet usage in every application

I would like to ask how can I get the Internet quantity that is used by some application, such as streaming, etc. I would like to make a program using in C # and I can’t start it ... give some advice thanks

+4
source share
3 answers

As a starting point, I would look at the WinSock API. You can find a way to get traffic information based on each process. If you want to see overall network usage, I would use performance monitoring tools. I found this example from a web search :

private static void ShowNetworkTraffic() { PerformanceCounterCategory performanceCounterCategory = new PerformanceCounterCategory("Network Interface"); string instance = performanceCounterCategory.GetInstanceNames()[0]; // 1st NIC ! PerformanceCounter performanceCounterSent = new PerformanceCounter("Network Interface", "Bytes Sent/sec", instance); PerformanceCounter performanceCounterReceived = new PerformanceCounter("Network Interface", "Bytes Received/sec", instance); for (int i = 0; i < 10; i++) { Console.WriteLine("bytes sent: {0}k\tbytes received: {1}k", performanceCounterSent.NextValue() / 1024, performanceCounterReceived.NextValue() / 1024); Thread.Sleep(500); } } 
+3
source

As far as I know, there is no standard method for measuring network bandwidth for each application. The most important thing you can get with standard tools is what netstat and perfmon show. The only way to calculate metrics for each application is to write an NDIS filter driver or use an existing filter driver such as WinPcap. But in both cases, you will have to install the driver on each target computer.

+1
source

Try the following: How to calculate network bandwidth speed in C #

EDIT

Now that I understand the question, better try this other SO question

0
source

Source: https://habr.com/ru/post/1339652/


All Articles