Mono Developer
Mono Developer

Reputation: 619

C# - Capturing Network Traffic

I'm interested in capturing network traffic from a specific computer. I am only interested in capturing traffic from the computer that my application is installed on (like Fiddler). Like Fiddler, I want to in particular capture the information shown in the "Web Sessions" portion (ID#, Http Status Code, Protocol, Host, Url, Body size, Content-Type and Process.

While I'm very knowledgable in C#. I have no idea how to actually capture network traffic like this. Can somebody please point me in some sort of direction.

Thank you so much!

Upvotes: 14

Views: 5937

Answers (2)

Jonathan Henson
Jonathan Henson

Reputation: 8206

winpcap or one of its .net wrappers is your best option. It is very well documented. If you are doing this in mono, you will need to use libpcap on unix machines. The api's are identical.

Upvotes: 1

David Hoerster
David Hoerster

Reputation: 28701

NOTE: I'm not 100% sure what you're looking for in terms of a stand-alone application or something to integrate into your application, but my answer will assume you're looking for something to integrate into your app. If not, I'll delete this.

If you're looking for something to integrate into your application that you can essentially enable or disable, you should take a look at FiddlerCore, which is the core functionality that Fiddler uses but can be integrated into stand-alone .NET apps.

The FiddlerCore wiki is here, and it describes the usage pretty well. The sample app is also a good description on how to use FiddlerCore.

Hope this helps. Good luck!

Upvotes: 6

Related Questions