Nikhil
Nikhil

Reputation: 2318

Does TCP endpoint that has sent a FIN, still send keepalive?

Sending a FIN is an indication that the end won't send any data. But can it send TCP keepalive?

If it can then it contradicts the statement of "sending stuff after FIN" even though it is keepalive but not data.

If it doesn't send keepalive, it won't detect if the other end is gone.

For ex:

Client send FIN and got ACK back. Server then sent a reset which was lost. Only way the client can detect that server has gone away is by sending keepalive which will be responded with reset and then the client closes.

Does this happen?

Upvotes: 8

Views: 2802

Answers (1)

jxh
jxh

Reputation: 70382

According to RFC-1122:

Keep-alive packets MUST only be sent when no data or acknowledgement packets have been received for the connection within an interval.

Sending FIN is only an indication that no more data will be sent, not that no more data can be received. If the application after sending FIN is still expecting data, the RFC indicates it can send a keep-alive packet to make sure the other end is still there.

Upvotes: 6

Related Questions