How To Block ALL PORTS

I need some code that illustrates how to block all ports for a computer such that no (Zero) internet activity can occur. ( and then be able to turn them back on again, just like a Firewall blocking all ports).

Who is Participating?
A hook on the TCP/IP stack calls? Just wondering...
Perhaps you could start here or with the Windows DDK
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

TheRealLokiSenior DeveloperCommented:
if it's a lan connection, you could simply clear your gateway, so data can not route
(route delete
and reset it after to your lan gateway
route add -p mask (if .1 is your router/gateway)
quantum2Author Commented:
Hey Sftweng,
thanks for the links. This will help a great deal. If you are interested, I will give you 300 more points if you take the Winsockfirewall code and create an sample application that has the following.

one form, two buttons.

Button 1 - Block all traffic
Button 2 - Enable traffic

Thats it.

While I havent looked at this code in great detail, it would appear that this is as simple as assigning a IP range rule from to

I got slammed at work and dont have time to weed through all of this, so if you are interested in creating a sample that uses their code and any libraries, all I would need is the units necessary to make the sample work as well as any components they are dependant on and the above listed functionality.

Thanks for the help

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.