Click here to Skip to main content
12,634,171 members (25,255 online)
Click here to Skip to main content
Add your own
alternative version

Stats

396.6K views
17.7K downloads
150 bookmarked
Posted

TrafficWatcher

, 15 Nov 2002 CPOL
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

SteveKing
Software Developer
Switzerland Switzerland
---

You may also be interested in...

Comments and Discussions

 
Generala version that works on Vista Pin
SteveKing23-Apr-09 20:40
memberSteveKing23-Apr-09 20:40 
QuestionRe: a version that works on Vista Pin
David Reis3-May-09 8:18
memberDavid Reis3-May-09 8:18 
GeneralMy vote of 2 Pin
Elmue16-Jan-09 5:46
memberElmue16-Jan-09 5:46 
GeneralDoes not function Pin
Elmue27-Mar-08 23:35
memberElmue27-Mar-08 23:35 
AnswerRe: Does not function [modified] Pin
o-lox15-Jan-09 6:08
membero-lox15-Jan-09 6:08 
QuestionDoes this work on Windows Vista? Pin
Dallas at Ekky25-Aug-07 19:04
memberDallas at Ekky25-Aug-07 19:04 
GeneralNot working on x64 systems Pin
manfbraun8-Apr-07 13:18
membermanfbraun8-Apr-07 13:18 
QuestionHow to Compile in VC++ 6 ! Pin
Inyong Jeong26-Apr-06 21:56
memberInyong Jeong26-Apr-06 21:56 
AnswerRe: How to Compile in VC++ 6 ! Pin
ddas7730-Aug-07 4:34
memberddas7730-Aug-07 4:34 
Generalworks with VC2002 and WinPCap 3.1 Pin
eurocent19-Apr-06 2:50
membereurocent19-Apr-06 2:50 
Generalsend the example website Pin
tssureshkumarin22-Oct-05 20:44
membertssureshkumarin22-Oct-05 20:44 
GeneralMemLeak Pin
dchris_med22-Oct-05 16:02
memberdchris_med22-Oct-05 16:02 
GeneralProblems with wpcap Pin
Vasil Nikolov11-Aug-05 4:47
memberVasil Nikolov11-Aug-05 4:47 
GeneralCannot run TrafficWatcher Pin
DavidNoon16-May-05 6:24
memberDavidNoon16-May-05 6:24 
QuestionWhy winpcap? Pin
Msftone1-May-04 12:44
memberMsftone1-May-04 12:44 
Generalerror compiling under vc7(vs .net 2003) Pin
smn30-Jan-04 3:28
membersmn30-Jan-04 3:28 
GeneralError downloading the source and demo Pin
Mourad DEBBAH10-Jan-04 23:23
memberMourad DEBBAH10-Jan-04 23:23 
GeneralRe: Error downloading the source and demo Pin
Uwe Keim27-Jan-04 23:08
sitebuilderUwe Keim27-Jan-04 23:08 
Questioncan't compile the resource ?? Pin
maginn8-Jan-04 0:26
membermaginn8-Jan-04 0:26 
GeneralDoes not work under Win-ME Pin
Stefan5-Jan-04 11:40
memberStefan5-Jan-04 11:40 
GeneralIncoherent ramble Pin
Colin Angus Mackay5-Jan-04 12:33
memberColin Angus Mackay5-Jan-04 12:33 
Questionis SDK needed to compile it under VC6? Pin
smn2-Dec-03 18:23
membersmn2-Dec-03 18:23 
AnswerRe: is SDK needed to compile it under VC6? Pin
SteveKing</font3-Dec-03 5:13
memberSteveKing3-Dec-03 5:13 
Generali read it before, but Pin
smn3-Dec-03 21:34
membersmn3-Dec-03 21:34 
GeneralRe: i read it before, but Pin
SteveKing</font4-Dec-03 7:19
memberSteveKing4-Dec-03 7:19 
GeneralGiving up Pin
pc414-Jun-03 1:36
memberpc414-Jun-03 1:36 
GeneralWorks if you remove old dlls Pin
jhaga3-Apr-03 11:51
memberjhaga3-Apr-03 11:51 
Generalntddndis.h Header File Missing Pin
rashvi9-Mar-03 0:23
memberrashvi9-Mar-03 0:23 
GeneralRe: ntddndis.h Header File Missing Pin
SteveKing</font9-Mar-03 0:33
memberSteveKing9-Mar-03 0:33 
Questionwhere is dsp? Pin
yangbit10-Feb-03 22:07
memberyangbit10-Feb-03 22:07 
AnswerRe: where is dsp? Pin
Florian Heidenreich11-Feb-03 0:49
memberFlorian Heidenreich11-Feb-03 0:49 
Questioncan we run this program in vc 6 Pin
sakthibala18-Jan-03 19:29
membersakthibala18-Jan-03 19:29 
AnswerRe: can we run this program in vc 6 Pin
SteveKing</font19-Jan-03 5:16
memberSteveKing19-Jan-03 5:16 
QuestionAnybody successfully compiled it under VC6? Pin
Kant20-Nov-02 9:24
memberKant20-Nov-02 9:24 
AnswerRe: Anybody successfully compiled it under VC6? Pin
gabmurillo20-Nov-02 14:26
membergabmurillo20-Nov-02 14:26 
AnswerRe: Anybody successfully compiled it under VC6? Pin
xyf_sky22-Apr-03 21:25
memberxyf_sky22-Apr-03 21:25 
GeneralRe: Anybody successfully compiled it under VC6? Pin
T Sandeep12-Mar-05 3:37
memberT Sandeep12-Mar-05 3:37 
GeneralErrors still happen Pin
hsieh19-Nov-02 23:36
memberhsieh19-Nov-02 23:36 
GeneralRe: Errors still happen Pin
SteveKing</font20-Nov-02 6:41
memberSteveKing20-Nov-02 6:41 
QuestionComplier Errors? Pin
Kant19-Nov-02 12:29
memberKant19-Nov-02 12:29 
AnswerRe: Complier Errors? Pin
gabmurillo19-Nov-02 14:01
membergabmurillo19-Nov-02 14:01 
GeneralRe: Complier Errors? Pin
Kant19-Nov-02 16:29
memberKant19-Nov-02 16:29 
GeneralRe: Complier Errors? Pin
gabmurillo19-Nov-02 20:09
membergabmurillo19-Nov-02 20:09 
AnswerRe: Complier Errors? Pin
jiang jianyu3-Mar-05 2:59
memberjiang jianyu3-Mar-05 2:59 
GeneralDoes this work for anyone Pin
gabmurillo19-Nov-02 11:13
membergabmurillo19-Nov-02 11:13 
GeneralRe: Didn't worked for me on my Laptop Pin
Kant19-Nov-02 11:53
memberKant19-Nov-02 11:53 
GeneralRe: Does this work for anyone Pin
Peter SJöström26-Nov-02 4:10
memberPeter SJöström26-Nov-02 4:10 
GeneralRe: Does this work for anyone Pin
SteveKing</font26-Nov-02 6:14
memberSteveKing26-Nov-02 6:14 
GeneralRe: Does this work for anyone Pin
Peter SJöström26-Nov-02 13:47
memberPeter SJöström26-Nov-02 13:47 
GeneralRe: Does this work for anyone Pin
SteveKing</font27-Nov-02 9:32
memberSteveKing27-Nov-02 9:32 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 16 Nov 2002
Article Copyright 2002 by SteveKing
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid