Getting connection throughput statistics

I need to define network usage statistics for each process, similar to what TCPView can do.

Example http://img513.imageshack.us/img513/861/6601f15814544055a590e26.png

So, before filming me for posting a duplicate of this question or this question , I would like to note that none of them have a detailed answer that could help me actually do this.

I do research, and there are many ways to list active connections and related processes, whether with netstat or other window APIs, such as Iphlpapi.dll .

Now, from what I did Google, I did not find much other than these vague terms: GetPerTcpConnectionEStats and GetPerTcp6ConnectionEStats . Presumably for TCP over IPv4 and IPv6 respectively. Now that I read it, I could do what I needed. However, this still leaves UDP. And they are also not available on XP systems running TCPViewer.

I would be pleased with the use for TCP, but the problem is that I cannot find examples of how to use them from C #.

So, I think it all comes down to the following questions:

  • Does anyone really know how TCPView does this?
  • How to use GetPerTcpConnectionEStats for TCP? Or can he even fulfill what I propose?
  • Is there any other alternative that will work for UDP?

, . .

.

+5
1

, , - ( ), - . , , , .

, , PInvoke, , .

Wrapper CodeProject AllocateAndGetTcpExTableFromStack, Windows XP Server 2003. - , .

, ( Vista/Server 2008 ), pinvoke.net GetExtendedTcpTable.

PInvoke Interop Assistant , .

, :

+1

All Articles