Monitoring data to / from a computer via vb.net

I want to create a bandwidth counter for Windows using vb.net, but I cannot find anything in the .net structure to control the amount of data in or out. I want to create this because I cannot find a good free one, and I think that is what people may want.

If there is nothing to monitor within .net, are there any P / Invoke calls that I can make? If so, what are they?

Is it possible that this project? I want to try to measure the exact amount of input and output data from all programs and connections, if possible.

Thanks for the help!

EDIT. To clarify, although I doubt that there will be something simple, like My.Computer.Network.IO or something like that, I really don't want to make it too complicated.

EDIT AGAIN: It might be too complicated. If I just wanted to control the activity of http on port 80, how could I do this without violating the data?

0
bandwidth
source share
6 answers

You need to go down to the driver level and control your ethernet device and count the bytes incoming and outgoing.

This will be associated with P / Invoke. I'm sure. Do not think that it is just ...

+1
source share

Some features:

  • WinPCap - will not give you the application, however
  • LSP - Loaded as a DLL into any process that uses Winsock. Gives you everything you want to track traffic for each application, but not just write.
  • WMI - Aggregate totals for the network interface: http://msdn.microsoft.com/en-us/library/aa394293(VS.85).aspx
+1
source share

You can easily fool this:

  • Create a process using cmd.exe
  • Call the command `netstat -e 10 '(within 10 seconds)
  • Output the output back to the application as input.
  • Input stream parsing
  • If the user decides to exit the program, send the break process to ctrl-c.

What do you think?

Hope this helps, Regards, Tom.

+1
source share
+1
source share

It is best to use performance counters or WMI and sample at a frequency that is convenient for you. If you are trying to get something similar to the number of bytes on the properties of the network card, then these counters are in the installed performance counter.

If you are also trying to measure all devices (USB, etc.), you will probably have to write your own client drivers to capture data transfer events.

+1
source share

There are several performance counters that give you basic bandwidth numbers on a network interface card. Start by looking at Perfmon.exe, you will see their category, name and instance name. The same numbers are available in the .NET PerformanceCounter class.

Using them to measure bandwidth is quite difficult; you will most likely evaluate the bandwidth of the server you are talking to in conjunction with dozens or so of routers that send an IP message to your computer.

+1
source share

All Articles