Search code examples
c#network-programmingbandwidth

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


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


Solution

  • 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.