Question

I would like to see how a program responds when it's connection is severed. Aside from disabling the network card, is there a way to sever a tcp connection in Windows without killing the process, or the thread that owns the connections?

Was it helpful?

Solution

The closest thing that I've found to generating an OS error is to use something like TcpView to look at what sockets are open and sever them. I'm not sure exactly what it does to sever the connection, but it does close it in a way that an application can see.

OTHER TIPS

TCPView by SysInternals lets you close a connection (and see all open connections).

One thing I've seen done is to have the network code written in such a way that a connection can be severed remotely. A product I once worked on was written that way. We even had a set of torture tests that would randomly break the connections. The product was meant to be transactional, and it was instructive to see how it behaved.

Of course, we then found a customer whose network was actually breaking connections all the time, and were very glad we'd tested so hard.

Why not just unplug the network cable?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top