MyFriendPM,
Try downloading a tool like
BitMeter 2[
^] to manage your bandwidth.
Or if you still want to write your own, I suggest using the following WMI query
select *
from Win32_PerfRawData_Tcpip_NetworkInterface
There are three columns that you will be interested in.
BytesReceivedPersec --> How much data has come in on an adapter
BytesSentPersec --> How much data your adapter has sent
BytesTotalPersec --> Total bandwidth sent and received.
Note that these numbers will be reset when your computer is restarted, so you'll have to keep track of them between boots. I'll let you write the code that uses the WMI, but that should put you in the right place!
Hogan