This toy close shows FIN ACK arithmetic only, not the full close lifecycle.

highlighted = computed this step

What this toy close shows

This book shows one client FIN and one server ACK. It only models close arithmetic.

FIN consumes=1\text{FIN consumes}=1
TCP close arithmetic boundaryThe toy TCP ACK segment is decoded from exact header bytes.ACK header160 bits / 20 bytes0x01bb9c4000001389000003ec5010100000000000byte 0byte 1byte 2byte 300000001101110111001110001000000byte 4byte 5byte 6byte 700000000000000000001001110001001byte 8byte 9byte 10byte 1100000000000000000000001111101100byte 12byte 13byte 14byte 1501010000000100000001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port443destination-port40000sequence-number5001acknowledgment-number1004data-offset5reserved0x0flags0x10window0x1000checksum0x0000urgent-pointer0

Checked values

Client FIN sequence 1003 plus one gives server ACK 1004.

1003+1=10041003+1=1004
TCP close arithmetic boundaryThe toy TCP ACK segment is decoded from exact header bytes.ACK header160 bits / 20 bytes0x01bb9c4000001389000003ec5010100000000000byte 0byte 1byte 2byte 300000001101110111001110001000000byte 4byte 5byte 6byte 700000000000000000001001110001001byte 8byte 9byte 10byte 1100000000000000000000001111101100byte 12byte 13byte 14byte 1501010000000100000001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port443destination-port40000sequence-number5001acknowledgment-number1004data-offset5reserved0x0flags0x10window0x1000checksum0x0000urgent-pointer0

What this does not model

NOTE: toy close arithmetic only; not simultaneous close, TIME_WAIT, retransmission, half-close APIs, RST, socket lifecycle, or real capture timing.

toy FIN exchange=1\text{toy FIN exchange}=1
TCP close arithmetic boundaryThe toy TCP ACK segment is decoded from exact header bytes.ACK header160 bits / 20 bytes0x01bb9c4000001389000003ec5010100000000000byte 0byte 1byte 2byte 300000001101110111001110001000000byte 4byte 5byte 6byte 700000000000000000001001110001001byte 8byte 9byte 10byte 1100000000000000000000001111101100byte 12byte 13byte 14byte 1501010000000100000001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port443destination-port40000sequence-number5001acknowledgment-number1004data-offset5reserved0x0flags0x10window0x1000checksum0x0000urgent-pointer0

Summary

FIN is a close signal, and TCP counts that signal as one sequence number.

ACK=1004\text{ACK}=1004
TCP close arithmetic boundaryThe toy TCP ACK segment is decoded from exact header bytes.ACK header160 bits / 20 bytes0x01bb9c4000001389000003ec5010100000000000byte 0byte 1byte 2byte 300000001101110111001110001000000byte 4byte 5byte 6byte 700000000000000000001001110001001byte 8byte 9byte 10byte 1100000000000000000000001111101100byte 12byte 13byte 14byte 1501010000000100000001000000000000byte 16byte 17byte 18byte 1900000000000000000000000000000000source-port443destination-port40000sequence-number5001acknowledgment-number1004data-offset5reserved0x0flags0x10window0x1000checksum0x0000urgent-pointer0