Click here to Skip to main content
15,886,823 members
Articles / Desktop Programming / MFC
Article

TrafficWatcher

Rate me:
Please Sign up or sign in to vote.
3.62/5 (24 votes)
15 Nov 2002CPOL2 min read 484.9K   18.7K   153   160
A tool to measure network traffic by service (FTP, mail, news, web, UDP etc)

Sample Image

Description

TrafficWatch is a small utility to get information about the amount of data transferred to and from the internet. It uses the WinPcap library from http://winpcap.polito.it/docs/default.htm. Network traffic inside a LAN is ignored - only IP packets going through the standard gateway are measured. Traffic is also measured by service: FTP, mail, news, web, UDP and others. So you can see for what you need your internet connection.

Why?

Flat rates are getting more common these days. ISPs often offer them only up to a specified amount of traffic - additional transferred data must be paid extra. So I wanted to know exactly how much traffic I use/need to decide which ISP and which offer I wanted. And of course I'm curious :)

Sample Image

Implementation

To gather only the internet traffic and ignore traffic inside LAN I needed a way to analyse every IP data packet entering or leaving the network interface. The WinPcap library is used to catch all these packets. Then the program analyses the captured packets by source and destination IP and port. With these data the program builds the statistics.

Other tools

There are other tools in this utility: Ping, Traceroute, Connection Information and Whois. The Whois-utility uses a text file to determine which server to ask for specific TLD's. The one offered with this utility is far from complete. If someone wants to complete it, please send me a copy!

Installation

An installer is provided. If you don't have WinPcap already installed, you must either download it from http://winpcap.polito.it/docs/default.htm or let the installer install it for you. After installation you should maybe restart your computer to proper initialize the WinPcap drivers - otherwise the program may crash.

Notes

For this tool I used many classes and tips from this website. Some of them are unchanged, some of them I changed a little or more. This tool is also kind of a try out project for me - whenever I want to try out some API's or functions I add them to this tool. An example of that you can see in the "About" pane. So please don't blame me if some things are not perfectly coded.

Update

16.11.02 fixed several bugs where the prog crashed on startup (I hope :). Also the statistics page now shows a red line in the bars to separate up from downloads.

22.6.02 corrected a bug where the statistics weren't correctly cleaned up. Fixed a bug where the program crashed when more than 10 adapters were found. Also fixed missing files in source.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Switzerland Switzerland
---

Comments and Discussions

 
GeneralRe: A quick temporary fix Pin
Flippant14-Sep-02 17:08
Flippant14-Sep-02 17:08 
GeneralRe: A quick temporary fix Pin
Flippant14-Sep-02 17:39
Flippant14-Sep-02 17:39 
GeneralI can find it in my system! Pin
Anonymous9-Jul-02 21:44
Anonymous9-Jul-02 21:44 
Generalthats a new one :) Pin
SteveKing10-Jul-02 6:43
SteveKing10-Jul-02 6:43 
GeneralRe: thats a new one :) Pin
richard_lee17-Jul-02 20:48
richard_lee17-Jul-02 20:48 
GeneralRe: thats a new one :) Pin
SteveKing18-Jul-02 5:26
SteveKing18-Jul-02 5:26 
GeneralRe: thats a new one :) Pin
mio17-Nov-02 22:14
mio17-Nov-02 22:14 
GeneralConfuse Pin
wism8-Jul-02 4:21
wism8-Jul-02 4:21 
GeneralRe: Confuse Pin
8-Jul-02 5:06
suss8-Jul-02 5:06 
GeneralRe: Confuse Pin
wism8-Jul-02 6:58
wism8-Jul-02 6:58 
GeneralRe: Confuse Pin
SteveKing9-Jul-02 4:39
SteveKing9-Jul-02 4:39 
GeneralRe: Confuse Pin
wism10-Jul-02 3:30
wism10-Jul-02 3:30 
GeneralRe: Confuse Pin
Flippant15-Sep-02 6:33
Flippant15-Sep-02 6:33 
GeneralCrashes on XP Pin
Takeru Koushirou7-Jul-02 6:28
Takeru Koushirou7-Jul-02 6:28 
GeneralRe: Crashes on XP Pin
SteveKing7-Jul-02 8:37
SteveKing7-Jul-02 8:37 
Generaliphlpapi.h Pin
wism3-Jul-02 0:33
wism3-Jul-02 0:33 
GeneralRe: iphlpapi.h Pin
SteveKing3-Jul-02 8:58
SteveKing3-Jul-02 8:58 
GeneralTesting Pin
Venet1-Jul-02 23:51
Venet1-Jul-02 23:51 
GeneralRe: Testing Pin
Stephan Pilz2-Jul-02 4:36
Stephan Pilz2-Jul-02 4:36 
GeneralRe: Testing Pin
SteveKing2-Jul-02 6:36
SteveKing2-Jul-02 6:36 
GeneralRe: Testing Pin
Stephan Pilz2-Jul-02 20:53
Stephan Pilz2-Jul-02 20:53 
GeneralRe: Testing Pin
Flippant14-Sep-02 16:58
Flippant14-Sep-02 16:58 
QuestionHow can i create the exe? Pin
h2-wow30-Jun-02 14:35
h2-wow30-Jun-02 14:35 
AnswerRe: How can i create the exe? Pin
SteveKing30-Jun-02 21:48
SteveKing30-Jun-02 21:48 
GeneralRe: How can i create the exe? Pin
Anonymous25-Jul-02 10:20
Anonymous25-Jul-02 10:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.