Click here to Skip to main content
6,290,721 members and growing! (18,352 online)
Email Password   helpLost your password?
General Programming » Internet / Network » General     Intermediate License: The Code Project Open License (CPOL)

TrafficWatcher

By SteveKing

A tool to measure network traffic by service (FTP, mail, news, web, UDP etc)
VC7Win2K, WinXP, MFC, Dev
Posted:19 Jun 2002
Updated:15 Nov 2002
Views:205,815
Bookmarked:114 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
45 votes for this article.
Popularity: 5.98 Rating: 3.62 out of 5
4 votes, 18.2%
1
1 vote, 4.5%
2

3
8 votes, 36.4%
4
9 votes, 40.9%
5

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)

About the Author

SteveKing


Member
---
Occupation: Software Developer
Location: Switzerland Switzerland

Other popular Internet / Network articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 160 (Total in Forum: 160) (Refresh)FirstPrevNext
Generala version that works on Vista PinmemberSteveKing20:40 23 Apr '09  
QuestionRe: a version that works on Vista PinmemberDavid Reis8:18 3 May '09  
GeneralMy vote of 2 PinmemberElmue5:46 16 Jan '09  
GeneralDoes not function PinmemberElmue23:35 27 Mar '08  
AnswerRe: Does not function [modified] Pinmembero-lox6:08 15 Jan '09  
GeneralDoes this work on Windows Vista? PinmemberDallas at Ekky19:04 25 Aug '07  
GeneralNot working on x64 systems Pinmembermanfbraun13:18 8 Apr '07  
GeneralHow to Compile in VC++ 6 ! PinmemberInyong Jeong21:56 26 Apr '06  
GeneralRe: How to Compile in VC++ 6 ! Pinmemberddas774:34 30 Aug '07  
Generalworks with VC2002 and WinPCap 3.1 Pinmembereurocent2:50 19 Apr '06  
Generalsend the example website Pinmembertssureshkumarin20:44 22 Oct '05  
GeneralMemLeak Pinmemberdchris_med16:02 22 Oct '05  
GeneralProblems with wpcap PinmemberVasil Nikolov4:47 11 Aug '05  
GeneralCannot run TrafficWatcher PinmemberDavidNoon6:24 16 May '05  
GeneralWhy winpcap? PinmemberMsftone12:44 1 May '04  
Generalerror compiling under vc7(vs .net 2003) Pinmembersmn3:28 30 Jan '04  
GeneralError downloading the source and demo PinmemberMourad DEBBAH23:23 10 Jan '04  
GeneralRe: Error downloading the source and demo PinsitebuilderUwe Keim23:08 27 Jan '04  
Generalcan't compile the resource ?? Pinmembermaginn0:26 8 Jan '04  
GeneralDoes not work under Win-ME PinmemberStefan11:40 5 Jan '04  
GeneralIncoherent ramble PinmemberColin Angus Mackay12:33 5 Jan '04  
Generalis SDK needed to compile it under VC6? Pinmembersmn18:23 2 Dec '03  
GeneralRe: is SDK needed to compile it under VC6? PinmemberSteveKing5:13 3 Dec '03  
Generali read it before, but Pinmembersmn21:34 3 Dec '03  
GeneralRe: i read it before, but PinmemberSteveKing7:19 4 Dec '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 15 Nov 2002
Editor: Chris Maunder
Copyright 2002 by SteveKing
Everything else Copyright © CodeProject, 1999-2009
Web13 | Advertise on the Code Project