Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm developing an application which is supposed to work in 2 modes online and offline. I need a simple and fast solution to block the internet connection for this particular application. Enabling/disabling this connection should be as fast as possible (one mouse click would be perfect) to test both modes.

This program is not installed, it's recompiled and executed every few minutes.

Can you recommend something?

share|improve this question
    
You could disconnect/reconnect your LAN cable.That should be faster than trying out a bunch of programs to accomplish what you're looking for... –  TFM Jan 25 '13 at 22:10

3 Answers 3

up vote 0 down vote accepted

You'll have to use a firewall to achieve what you want. Windows Firewall is enough, but I'd suggest using a free software like COMODO Firewall because it's easier to configure and it always worked for me.

To block a program from accessing internet, go to Firewall settings > Define a New Blocked Application > Choose a running process or browse and select your program's executable file.

enter image description here

That's it! The application is now blocked from accessing internet. Then when you want to allow access, just go to "Network Security Policy" (it's hidden beneath the dialog) and allow it. As you need to quickly switch access, keep the "Network Security Policy" dialog open to do so.

share|improve this answer

You could block the program at the firewall, just put these in batch files (.bat), one to enable, one to disable.

Allow

netsh advfirewall firewall add rule name="ProgramTesting" dir=out action=allow program="C:\yourprogram.exe"

Deny

netsh advfirewall firewall add rule name="ProgramTesting" dir=out action=block program="C:\yourprogram.exe"
share|improve this answer
    
The result is "OK." but my app can still access the web :( –  gisek Jan 25 '13 at 23:30

The easiest way to temporarily disable the internet is disable the DHCP Client. The easiest way to do this (on windows XP) is,

  • Right click on your My Computer Icon
  • Click Manage
  • Select Services and Applications
  • Select Services
  • Find DHCP Client

All you have to do is right click on it and hit stop. When you want to enable it again follow the same steps but this time hit start.

This is completely harmless to your computer.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.