views:

229

answers:

1

How do I measure the upload and download bandwidth utilization per each process on windows xp/2003/2008 in realtime using C#?

+1  A: 

Use one of these 2 libraries to capture packets :

http://www.codeproject.com/KB/cs/pacanal.aspx

or

http://www.codeproject.com/KB/cs/pktcap.aspx

. Then:

  • Capture all packets
  • For each packet, get the associated process
  • With the packet length and the current time, for each process, you'll be able to compute the bandwidth used.

In fact, once you manage to capture the packets, and associate them to a process, it's done. Then all you have to do is a bit of algebra.

There may be other solutions, but that's the only one I can think of right now.

FWH