Restricting tcp communication to specific ip's using C#

368 views Asked by At

I want to make a simple program that can restrict any communication over the internet except for some specific ip's. So that the user can eliminate any unwanted traffic. It has to be simple and the user must be able to switch it on and off on the fly.

My first thought was to use Windows Firewall and set it up using C#/WPF. And it might be possible. But is there a more simple way?

Platform: Vindows 7, .NET 3.5

Cheers

2

There are 2 answers

0
Jeremy Morgan On BEST ANSWER

I would just use windows firewall as you mentioned. Much simpler. Here is a good tutorial on modifying the windows firewall in C#.

0
Preet Sangha On

You are essentially creating a firewall. One or your better options would be to use an exising firewall and control it from your program. Since there is one built into windows that would be my first choice.

That said another option is to create a proxy layer into the IP stack . Finally if your users are limited to a single comms program (say IE or what not) then you could just create/use a proxy server type program.