user4572253
user4572253

Reputation:

Are FIN packets guaranteed to arrive?

In the 4-way handshake, we have the following:

FIN ------->
<------- ACK
<---x--- FIN (what if this packet is lost?)
ACK ------->

What happens if the third packet is lost, will it be re-transmitted? Note that by the time the third packet is sent, the program will have probably destroyed the socket, and so it can't send anything anymore!

Upvotes: 0

Views: 373

Answers (1)

Pavel Šimerda
Pavel Šimerda

Reputation: 6163

TCP protocol

All segments preceding and including FIN will be retransmitted until acknowledged.

Source: https://www.rfc-editor.org/rfc/rfc793

Socket

You can use your operating system tools to see open TCP sockets and their states. During the TCP finalization the socket is first open for bi-directional communication, then each side closes its direction and each FIN has to be acknowledged before the resources are freed in the operating system.

In order to retransmit the FIN packet, the connection must be still represented in the OS until the FIN is acked or timed out.

Upvotes: 3

Related Questions