TCP Networking – Why TCP Client Doesn’t Receive ACK Response After Sending FIN Package

networkingtcp

I use the WireShark captured the TCP connect.

you see the three-way handshake(1-3) and the four-way handshake(5-8):

enter image description here

But, from the frame list, I have a question about TCP.

You know the TCP should use ACK sign to get the response, no matter the ack for syn, or ack for data send.

you see the 4rd frame, the 192.168.187.1 send the message to 192.168.187.129 [PSH, ACK].

  1. but the 192.168.187.1 haven't get a ACK, it send the FIN package to 192.168.187.129, why?

  2. in the 5rd package, can it send the [FIN] package directly? why there need the [FIN, ACK]? why can not send the [FIN]?

Best Answer

  1. RFC 793 indicates that:

FIN

A control bit (finis) occupying one sequence number, which indicates that the sender will send no more data or control occupying sequence space.

If the sender has no more data to send, it sends a packet which its FIN flag is set. If the receiver doesn't receive data, it will send a duplicate ACK to the sender.

So the sender waits for a time and if it doesn't receive acknowledgment of the FIN or data within this time, or if it receives a duplicate ACK, it will retransmit the packets.

  1. ACK control flag is always sent once a connection is established; As RFC 793 says:

Acknowledgment Number: 32 bits

If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive. Once a connection is established this is always sent.

Edit: So until the connection is not established, packets can be sent without ACK.

For example, when one side of the connection sends SYN packet and doesn't receive any acknowledgment; in this case, it can send a FIN packet without ACK, since there is nothing to acknowledge it.

RCF793:3.5. Closing a Connection also indicates that:

The user who CLOSEs may continue to RECEIVE until he is told that the other side has CLOSED also.

Sending ACK will tell to the sender that which sequence number is expected to receive and it prevents extra retransmissions that occur because of ACK lost.


Edited based on @ron-maupin 's comment.

Related Topic