views:

206

answers:

4

I'm trying to test out modes of failure for software that interacts with a web service, and I've already had reported issues where problems occur if the software doesn't get a timely response (e.g., it's waiting a minute or longer). I'd like to simulate this so that I can track down and fix issues myself, but unplugging the network connection doesn't do the trick, because it returns immediately with no route found.

What I'd like to know is, is there a simple way I can make a CGI script that accepts a connection but just sits there, keeping the connection alive for several minutes, without doing a while (true) {} type of loop?

+3  A: 

How about letting the script sleep for some (very long) time?

Adrian Grigore
+3  A: 

I don't know what language you are using for your scripting, but in .net you could do something like Thread.Sleep(6000);

Jason
A: 

You will have to idle in some way since if your CGI script returns the connection will get closed.

If your network equipment supports throttling you might want to limit outgoing traffic to something ridiculously low.

Ben S
+2  A: 

HTTP Fiddler is excellent for this sort of thing. You can simulate slow connections and, if you want, get it to "break" when a request comes in so you can similate a response that never returns.

Go get it from here... http://www.fiddlertool.com/fiddler/

Martin Peck