As per title. Sorry if this is a duplicate question, but in the numerous posts online, I could only find how a connection is torn down, but not (convincingly) why it is done in such a way.
1. A -----FIN-----> B 2. A <----ACK------ B 3. A <----FIN------ B 4. A -----ACK-----> B <====== Why is this one necessary? ======if 3 or 4 lost======= 5. A <....FIN...... B 6. A .....ACK.....> B
It seems B can shutdown the socket as soon as it sends out its
- if the
FIN(3)is not lost, all is well.
- if it is lost, A can timeout anyway and close the connection. One can argue that if this does happen, A will have to wait for a very long time. But B bears some risk with this last
ACK(4)as well. Suppose the connection suddenly goes down (though with low probability) right after A sends out the last
ACK(4), causing B unable to receive it. Then B will have to wait and timeout, too. Since both approaches are flawed, why not save this last
I think the only exception is that there is a reasonably high chance of packet loss such that both
ACK(4) won't arrive.
FIN(3) is lost, receiving nothing back from A, B will resend its new
ACK(4) is lost, B will think that its
FIN(3) is lost and resend the
FIN(5) as well. A, though having sent out
ACK(4), is supposed in the
TIME-WAIT status, will hopefully receive this new
FIN(5) and resend an
It seems only if the scenario described above happens reasonably frequently, will the last
ACK(4) have a significant impact.