Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I simulate a socket disconnection (on windows) between a client and a server?

I've implemented a kind of 'heartbeat solution' and I'd like to see what happen when the network 'goes down', in real conditions, specially if it happens when there is no traffic on the socket.

Problems: - I've got only one computer; - I'm on windows/java;

I guess that simply unplugging the network cable/deactivating the network card won't affect the two processes, as they are running on the same box; Is there a programmatic solution to that? A kind of way to force close a socket ?

like image 281
Fabien Benoit-Koch Avatar asked Oct 20 '25 14:10

Fabien Benoit-Koch


2 Answers

I use TCPView to right click and close sockets.

like image 140
Richard Avatar answered Oct 22 '25 02:10

Richard


if you are using Eclipse, there is a TCP/IP Monitor, WIndow -> Show View -> Other -> type filter text = TCP/IP and create a new forwarding tcp/ip you can monitor and stop that in the middle.

like image 26
silmx Avatar answered Oct 22 '25 02:10

silmx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!