Packet Sniffing in C#

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?.

E.g.

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).

rmpalmerAsked:
Who is Participating?
 
cyberdevil67Commented:
Hi rmpalmer,

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

http://www.codeproject.com/csharp/networkmonitor.asp

Cheers!
0
 
MudieCommented:
This should be exactly what you need: http://www.codeproject.com/useritems/HSSniffer.asp
"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!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.