Click here to Skip to main content
11,413,548 members (74,216 online)
Click here to Skip to main content

Applications Traffic Watcher

, 17 Jul 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
Applications Traffic Watcher is a small utility to get information about the amount of data transferred to and from the Internet.
Sample Image - apptraffwatcher.gif - Click to enlarge image

Introduction

Applications Traffic Watcher (ATW) is a small utility to get information about the amount of data transferred to and from the Internet. It uses the WinPcap library from here.

Network traffic inside a LAN is calculated, but ignored when calculating costs. So, you can see which applications are consuming traffic. ATW is very useful in understanding how much traffic is consumed by Skype, Gizmo etc.

Main Idea

The idea of the application is quite simple:

  1. Application Traffic Watcher constantly gets packets from WinPCap.
  2. It tries to associate packets with process ID using packet's information about local address and port and also information about all active connections, using the functions GetExtendedTcpTable or GetExtendedUdpTable.
  3. If the application cannot associate the packet with its corresponding process ID, add this packet to a "virtual" application named "Unknown_" and local port number. Unfortunately, sometimes it cannot associate a packet with a process (see "Problems" section of the article).
  4. ATW determines that either the packet belongs to a local network or to the Internet using lib IPNumber (Read this article).

Installation

There is no installation required if WinPcap is already installed. Just run the *.exe file. Otherwise you must download WinPCap from here and install it. After installation, you should maybe restart your computer to properly initialize the WinPcap drivers - otherwise the program may crash.

Problems

As you can see in the screen shot, there are a lot of processes specified as "Unknown_". Unfortunately, I couldn't find any way to determine which application sends/receives packets. Packets couldn't be identified when Internet Explorer/Firefox etc. download some Web pages. They create a lot of connections on different local ports with unknown PIDs (I couldn't associate the connection which I get from GetExtendedTcpTable and packet which I get from WinPCap). So, if you can help to resolve this problem, you are welcome to do so.

Another big problem - sometimes ATW consumes a lot of CPU resources and I couldn't minimize it for now.

References

  1. SharpPcap - A Packet Capture Framework for .NET
  2. IP list, Check an IP Number against a List in C#
  3. Getting Active TCP/UDP Connections on a Box
  4. Getting Active TCP/UDP Connections using GetExtendedTcpTable Function
  5. TrafficWatcher

Tools

To understand how Microsoft does some things and for code optimization, I used the following tools:

  1. Reflector for .NET
  2. Interactive Disassembler (IDA)
  3. ANTS
  4. Sysinternals tools
  5. Microsoft Netstat

License

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

Share

About the Author

Warlib
Web Developer
Russian Federation Russian Federation
I am a CIO in Nizhny Novgorod, Russia.

Comments and Discussions

 
QuestionI have a solution the the UnKnow processes Pin
Member 10010413 at 27-Apr-13 8:04
memberMember 1001041327-Apr-13 8:04 
QuestionWin7 x64 [modified] Pin
Andrew de Jonge at 3-Oct-12 3:50
memberAndrew de Jonge3-Oct-12 3:50 
Questioncraft packet? Pin
Unruled Boy at 1-Jan-09 16:37
memberUnruled Boy1-Jan-09 16:37 
Questionatw Pin
Jan Stetka at 11-Apr-08 13:04
memberJan Stetka11-Apr-08 13:04 
GeneralFull Project Pin
M.A.B. at 30-Jul-07 3:48
memberM.A.B.30-Jul-07 3:48 
GeneralCannot stop monitoring and cannot close the application Pin
Nonthanut at 24-Apr-07 22:53
memberNonthanut24-Apr-07 22:53 
GeneralDoes not run on x64 windows Pin
manfbraun at 8-Apr-07 13:32
membermanfbraun8-Apr-07 13:32 
GeneralRe: Does not run on x64 windows Pin
Warlib at 8-Apr-07 21:02
memberWarlib8-Apr-07 21:02 
GeneralRe: Does not run on x64 windows Pin
manfbraun at 8-Apr-07 23:39
membermanfbraun8-Apr-07 23:39 
Hi !

Thanks for your reply! But I think, XP and Server are identical, be it x86 or x64. No idea about Vista/Longhorn. I used the IPHelperAPI also, but only for my ARP requests;This works.

Anyway, thanks so far;If I would find dthe time, I'll look into it.

Best regards,
Manfred


Ciao,
mb

GeneralWrong IPNumbers Version Pin
KevinI59 at 30-Jul-06 6:37
memberKevinI5930-Jul-06 6:37 
GeneralRe: Wrong IPNumbers Version Pin
Warlib at 30-Jul-06 9:04
memberWarlib30-Jul-06 9:04 
Generalmissing projects in zip files Pin
David Every at 10-Jul-06 17:30
memberDavid Every10-Jul-06 17:30 
GeneralRe: missing projects in zip files [modified] Pin
Warlib at 10-Jul-06 20:18
memberWarlib10-Jul-06 20:18 
GeneralRe: missing projects in zip files Pin
chakkaradeepcc at 27-Sep-06 19:38
memberchakkaradeepcc27-Sep-06 19:38 
GeneralRe: missing projects in zip files Pin
Warlib at 27-Sep-06 20:03
memberWarlib27-Sep-06 20:03 
GeneralRe: missing projects in zip files Pin
chakkaradeepcc at 27-Sep-06 21:50
memberchakkaradeepcc27-Sep-06 21:50 
GeneralRe: missing projects in zip files Pin
Warlib at 27-Sep-06 21:58
memberWarlib27-Sep-06 21:58 
GeneralRe: missing projects in zip files Pin
chakkaradeepcc at 27-Sep-06 22:36
memberchakkaradeepcc27-Sep-06 22:36 
GeneralRe: missing projects in zip files Pin
Warlib at 27-Sep-06 22:51
memberWarlib27-Sep-06 22:51 
GeneralRe: missing projects in zip files Pin
Tefo at 25-Jul-07 4:13
memberTefo25-Jul-07 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web04 | 2.8.150427.1 | Last Updated 18 Jul 2006
Article Copyright 2006 by Warlib
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid