I am confused on how do TCP work. I was testing this. I have a TCP Connection established between two clients (Client A and
, nothing is being transmit between the two clients. When I forcefully close one client (say Client
by shutting down the process, I was expecting the other side (Client A) will not notice. Since no close connection request between two side. The testing is implemented in Java.
Supprisingly, the other immediately throw an exception:
java.net.SocketException: Connection reset
I don't understand that, how does the other know that the link is broken? I can only think of there is some underlying mechanism in the TCP stack which keeps on sending alive packet to test the link. Is that true? which layer is it? or there is some other thing that cause this to happen?
0 · ·