Artificially create a connection timeout error

I’ve had a bug in our software that occurs when I receive a connection timeout. These errors are very rare (usually when my connection gets dropped by our internal network). How can I generate this kind of effect artificially so I can test our software?

If it matters the app is written in C++/MFC using CAsyncSocket classes.

Edit:

I’ve tried using a non-existent host, and I get the socket error:

WSAEINVAL (10022) Invalid argument

My next attempt was to use Alexander’s suggestion of connecting to a different port, e.g. 81 (on my own server though). That worked great. Exactly the same as a dropped connection (60 second wait, then error). Thank you!

21 Answers
21

Leave a Comment