The receiver answers a FIN with the next client sequence slot.

highlighted = computed this step

The server acknowledges the FIN

The client sends FIN at sequence 1003. The server answers with ACK 1004.

ACK=1004\text{ACK}=1004
Server ACKs the FINA toy TCP close timeline shows the client FIN followed by the server ACK.Server ACKs the FINClientESTABLISHEDFIN-WAITServerESTABLISHEDCLOSE-WAITFIN seq=1003 FIN, ACKACK seq=5001 ack=1004 ACK

FIN then ACK

The timeline order is small: FIN first, ACK second.

messages=2\text{messages}=2
Server ACKs the FINA toy TCP close timeline shows the client FIN followed by the server ACK.Server ACKs the FINClientESTABLISHEDFIN-WAITServerESTABLISHEDCLOSE-WAITFIN seq=1003 FIN, ACKACK seq=5001 ack=1004 ACK

The server uses its own sequence number

The server's ACK segment uses server sequence 5001. That is separate from the client FIN count.

server seq=5001\text{server seq}=5001
Server ACKs the FINA toy TCP close timeline shows the client FIN followed by the server ACK.Server ACKs the FINClientESTABLISHEDFIN-WAITServerESTABLISHEDCLOSE-WAITFIN seq=1003 FIN, ACKACK seq=5001 ack=1004 ACK

Summary

The ACK confirms the FIN and asks for the next client sequence slot.

next client slot=1004\text{next client slot}=1004
Server ACKs the FINA toy TCP close timeline shows the client FIN followed by the server ACK.Server ACKs the FINClientESTABLISHEDFIN-WAITServerESTABLISHEDCLOSE-WAITFIN seq=1003 FIN, ACKACK seq=5001 ack=1004 ACK