Click here to Skip to main content
15,889,776 members
Articles / Programming Languages / C#
Article

RawSocket Class-Create Network Monitoring (Packet Sniffing) Apps

Rate me:
Please Sign up or sign in to vote.
4.83/5 (17 votes)
11 Apr 2002 253.3K   3.2K   71   50
A class for creating Network Monitoring Programs

Introduction

This program illustrates the use of the RawSocket class which is written in C#. The class RawSocket is a packet sniffing class that fires notification events when an IP packet is received. This makes using the class simple. Just declare your RawSocket object, instantiate it, and register to be notified when the event fires.

When the event fires, you are sent event arguments which give your program access to everything in the IP packet including things like IP addresses, port numbers, protocols, message lengths, and of course the message contents.

The included Windows form is a simplified example which basically just shows the origination and destination IP addresses for all incoming packets on a listbox control. The Rawsocket class makes creating more sophisticated network monitoring applications easy.

This program relies on Winsock 2 and runs only on Win2000 or WinXP.

Please email comments and improvements to:

Kember Brown
kbrown@internetcds.com

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Lyle is a computer programmer in Vancouver, Washington.

Comments and Discussions

 
QuestionHow about a C++ version? Pin
McGarrah15-Apr-02 3:14
McGarrah15-Apr-02 3:14 
AnswerRe: How about a C++ version? Pin
Amit Dey15-Apr-02 6:03
Amit Dey15-Apr-02 6:03 
AnswerRe: How about a C++ version? Pin
Lyle Brown15-Apr-02 8:42
Lyle Brown15-Apr-02 8:42 
AnswerRe: How about a C++ version? Pin
5.5 cents25-Nov-03 21:28
suss5.5 cents25-Nov-03 21:28 
GeneralUnexplained Pin
Nick Parker13-Apr-02 1:55
protectorNick Parker13-Apr-02 1:55 
GeneralRe: Unexplained Pin
Lyle Brown13-Apr-02 13:30
Lyle Brown13-Apr-02 13:30 
GeneralSomething's missing Pin
Jason Douglas12-Apr-02 9:29
professionalJason Douglas12-Apr-02 9:29 
GeneralRe: Something's missing Pin
Nish Nishant12-Apr-02 17:50
sitebuilderNish Nishant12-Apr-02 17:50 
http://www.codeproject.com/useritems/NetworkMonitor/NetworkMonitor_src.zip

Nish


One little CD gone,
Then two CDs gone,
Then 5 more gone,
For a total 7 gones,
If I was a CD R,
I'd wanna cry,
Cause I'd be just a goner,
For a nasty CD burner.

[funny how frustration wakes up the poet in me]

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.