Archived

This topic is now archived and is closed to further replies.

atreyu

Packet Filtering....I think that's the right term

Recommended Posts

Does anyone know where can I find info on this? I''m not having much luck. I need to write an app that logs incoming and outgoing traffic to my computer. (My college has a 750mb DL limit and they aren''t going to be happy if I break it again). Is packet filtering the right area to learn if I want to do this? I''m basically trying to sound an alarm if my traffic for the day approaches ~750MBs. I''m using MSVC6 by the way. Thanks for your help. --Ben P.S. I know there is probably a program out there that already does this, but this sounds more fun d e e p s k y . s 5 . c o m "Who is General Failure and why is he reading my disk?"

Share this post


Link to post
Share on other sites
Have look at the performance counters. To give it a try before you start coding, run "perfmon" - you can look at all the counters available to you there.

Next, look up PdhOpenQuery() in MSDN, and you should be fine from there. To each query, you add a number of counters, the name of a counter will look something like "\Network Interface()\Total Bytes Sent/sec" or whatever. The meaning of that counter should be obvious. One thing to note is that even though it says "Bytes Sent/sec", it actually just counts the number of bytes. The PDH library uses that value, the value at the last query and the time since the last query to work out the bytes sent/sec. This way, you can possibly use the raw counter data to get the total number of bytes (or, just add up the values you get from the formatted query).

What I''ve just said there may sound a little complicated, but it''s really quite simple, and you should be able to get something going in no time.

Note that the performance counters are available only on Windows NT/2000/XP. There is a way to get similar data on Windows 9X, but it involves looking in the HKEY_DYN_DATA registry keys and isn''t very user-friendly...


codeka.com - Just click it.

Share this post


Link to post
Share on other sites