Packet Sniffing in C#

Posted on 2005-05-01
Last Modified: 2011-09-20
Basically I am attempting to create a packet sniffer to capture all packets leaving my machine to port 80 on a remote web server. The program will be used to replay requests made to the remote server, to test if the web sites we have running on the remote server can handle large volumes of traffic (requests). I would prefer to create this package from the ground up so i can learn how it all works. Could you please explain how to create a packet sniffer in C# and how the recorded packets could be replayed to the server, using sockets or some thing?.


a)  10 requests (and HTTP/POST data) are sent from a web browser to a website on a remote server.
b) The 10 requests are recorded (and the data).
c) The 10 requests are replayed with the exact delays recorded during the packet transfur, but multiplied by upto around 10,000 times, over random intervals (would you use threads for this?).

Please explain how to use the classes needed for creating this program ( a full solution is not needed, just an understanding of what classes to use and how to use them).

Question by:rmpalmer
    LVL 9

    Accepted Solution

    Hi rmpalmer,

     This link may help you, this site has a couple of other examples as well.

    LVL 2

    Assisted Solution

    This should be exactly what you need:
    "Project is an implementation of a Packet Sniffer that captures packet in a LAN environment using Microsoft .Net environment and written in C#.


    Our goal was to build a network utility tool that can be an assistant to programmers, network managers, and private users. Our Sniffer can be useful for monitor traffic, debugging, fault analysis, network protocol analysis, network intrusion detection, traffic measuring etc." - (taken from above link)

    Also includes the full source.

    Hope it helps!

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now