Closing TCP Connection Question? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Closing TCP Connection Question?

Hi experts,

I am confused on how do TCP work. I was testing this. I have a TCP Connection established between two clients (Client A and B), nothing is being transmit between the two clients. When I forcefully close one client (say Client B) 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?

Best Regards
Ferdinand Ng

Comments

Sign In or Register to comment.