[英]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;
- 我在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 ?
一种强制关闭套接字的方法?
我使用TCPView右键单击并关闭套接字。
如果您正在使用Eclipse,则有一个TCP / IP监视器,WIndow - > Show View - > Other - > type filter text = TCP / IP并创建一个新的转发tcp / ip,您可以监视并在中间停止它。
You can also simulate two computers with virtual computers. 您还可以使用虚拟计算机模拟两台计算机。
I use VirtualBox for making myself more computers :D. 我使用VirtualBox让自己更多的电脑:D。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.