Programming for windows: Getting per connection bandwidth statistics on newest questions tagged windows – Stack Overflow

I need to determine per-process network usage statistics similar to what TCPView can do.

Example

So before you shoot me for posting a duplicate of this question, or this question, I would like to point out that neither of those have a thorough answer that could help me actually do this.

I’ve been doing research, and there are clearly many ways to list out active connections and their associated processes, whether this be with netstat or other windows API’s like IpHlpAPI.dll.

Now, from what Google’ing I’ve done, I have not found much – except for these vague terms: GetPerTcpConnectionEStats and GetPerTcp6ConnectionEStats. Presumably for TCP over IPv4 and IPv6. Now where I was reading its supposedly able to do what I need to do. However, that still leaves out UDP. And those are also not available on XP systems, which TCPViewer works on.

I would be satisfied with using those for TCP, but the problem is, I can’t seem to find any examples of how to use them from C#.

So I guess it all boils down to these few questions:

  • Does anyone actually know how TCPView does it?
  • How do I use GetPerTcpConnectionEStats for the TCP? Or can it even accomplish what I’m suggesting?
  • Is there another known alternative that would work for UDP?

The whole point of this is to see the independent bandwidth usage of the processes themselves. Not calculate the total system bandwidth usage.

Thanks in advance for any and all answers.

See Answers


source: http://stackoverflow.com/questions/9651576/getting-per-connection-bandwidth-statistics
Programming for windows: programming-for-windows



online applications demo