FIN advances the sender's sequence space by exactly one.

highlighted = computed this step

FIN consumes one sequence number

The client FIN starts at sequence 1003. TCP counts the FIN as one sequence position.

1003+1=10041003+1=1004
FIN consumes oneThe toy TCP FIN segment is decoded from exact header bytes.FIN header160 bits / 20 bytes0x9c4001bb000003eb000013895011100000000000byte 0byte 1byte 2byte 310011100010000000000000110111011byte 4byte 5byte 6byte 700000000000000000000001111101011byte 8byte 9byte 10byte 1100000000000000000001001110001001byte 12byte 13byte 14byte 1501010000000100010001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port40000destination-port443sequence-number1003acknowledgment-number5001data-offset5reserved0x0flags0x11window0x1000checksum0x0000urgent-pointer0

The next client slot is 1004

After the FIN, the next client sequence slot is 1004.

next client slot=1004\text{next client slot}=1004
FIN consumes oneThe toy TCP FIN segment is decoded from exact header bytes.FIN header160 bits / 20 bytes0x9c4001bb000003eb000013895011100000000000byte 0byte 1byte 2byte 310011100010000000000000110111011byte 4byte 5byte 6byte 700000000000000000000001111101011byte 8byte 9byte 10byte 1100000000000000000001001110001001byte 12byte 13byte 14byte 1501010000000100010001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port40000destination-port443sequence-number1003acknowledgment-number5001data-offset5reserved0x0flags0x11window0x1000checksum0x0000urgent-pointer0

Why the ACK does not stay at 1003

The server has received the FIN at 1003, so it asks for the next slot after that control flag.

next wanted=1004\text{next wanted}=1004
FIN consumes oneThe toy TCP FIN segment is decoded from exact header bytes.FIN header160 bits / 20 bytes0x9c4001bb000003eb000013895011100000000000byte 0byte 1byte 2byte 310011100010000000000000110111011byte 4byte 5byte 6byte 700000000000000000000001111101011byte 8byte 9byte 10byte 1100000000000000000001001110001001byte 12byte 13byte 14byte 1501010000000100010001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port40000destination-port443sequence-number1003acknowledgment-number5001data-offset5reserved0x0flags0x11window0x1000checksum0x0000urgent-pointer0

Summary

The FIN flag advances the client-side sequence count by exactly one.

FIN ACK=1004\text{FIN ACK}=1004
FIN consumes oneThe toy TCP FIN segment is decoded from exact header bytes.FIN header160 bits / 20 bytes0x9c4001bb000003eb000013895011100000000000byte 0byte 1byte 2byte 310011100010000000000000110111011byte 4byte 5byte 6byte 700000000000000000000001111101011byte 8byte 9byte 10byte 1100000000000000000001001110001001byte 12byte 13byte 14byte 1501010000000100010001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port40000destination-port443sequence-number1003acknowledgment-number5001data-offset5reserved0x0flags0x11window0x1000checksum0x0000urgent-pointer0