I have a network C++ program in Windows that I’d like to test for network disconnects at various times. What are my options?
Currently I am:
- Actually disconnecting the network wire from the back of my computer
- using ipconfig /release
- Using the cports program to close out the socket completely
None of these methods though are ideal for me, and I’d like to emulate network problems more easily.
I would like for sometimes connects to fail, sometimes socket reads to fail, and sometimes socket writes to fail. It would be great if there was some utility I could use to emulate these types of problems.
It would also be nice to be able to build some automated unit tests while this emulated bad network is up.
You might want to abstract the network layer, and then you can have unit tests that inject interesting failure events at appropriate points.