AndyMcoy
AndyMcoy

Reputation: 361

How to test handling of TCP write timeout?

I have written an application that reads from and writes to a tcp socket.

Suppose the ethernet cable is unplugged after the application sends a message but before the TCP-level ACK response. An exception will thrown in my application.

How can I test the exception handling without physically unplugging the cable?

I'm using an application-level protocol that does not implement acknowledgments of its own.

I'm on windows but am open to solutions involving linux as well.

Upvotes: 0

Views: 390

Answers (1)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136266

Establish a TCP connection with a peer in a virtual machine, then kill the virtual machine with kill -KILL <pid>. Check in Wireshark that killing the virtual machine doesn't cause it to emit RST packet (because unplugging the cable doesn't).

Upvotes: 2

Related Questions