2

I have an application that connects to database on remote server. I need to test how application will works in case when temporary lost connection. I cannot disconnect network cable. Does it possible to interrupt temporarily connection and after restore? OS - windows. Thanks.

user710818
  • 23,228
  • 58
  • 149
  • 207
  • Can you disable your network? You can do that from Network Adapter settings. – AppleGrew Jan 30 '12 at 13:20
  • I cannot disable my network throw control panel. I think that some application can do. – user710818 Jan 30 '12 at 13:23
  • By you cannot, do you mean that you do not have the privilege of that? – AppleGrew Jan 30 '12 at 13:25
  • Why you ask about privileges? How it can be related to my question? I create connection in my application. For test I need to check how it works when connection will be interrupted. It must reconnect. – user710818 Jan 30 '12 at 13:36

2 Answers2

1

In windows you can use netsh command to disable a network interface. See the usage in this answer. But I believe this command behaves differently according to the OS version...

If it does not work maybe try the devcon utility.

The DevCon utility is a command-line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. DevCon also provides information that is relevant to the driver developer and is not available in Device Manager.

You can use DevCon with Microsoft Windows 2000, Windows XP, and Windows Server 2003. You cannot use DevCon with Windows 95, Windows 98, or Windows Millennium Edition.

Community
  • 1
  • 1
Filipe Miguel Fonseca
  • 6,400
  • 1
  • 31
  • 26
1

You can use a software firewall if you have one that blocks certain applications. Even the Windows firewall (Win 7 & Vista) has this option.

Mike
  • 3,017
  • 1
  • 34
  • 47