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:
Lyle is a computer programmer in Vancouver, Washington.