Thanks a lot guys. In fact my programme is about two processes running on the same machine, one acts as a master piece, while the other one is a client. The client connects to the master through certain ports. If the client detected the loss of connection, it will try to reconnect. So what I want to test is when the link broken, what will happen. But the problem is they are running on the same machine, how can I cut their connection?