TCP Handshake Simulator
Step through SYN → SYN-ACK → ACK, data transfer and the close sequence
Client state
CLOSED
Server state
LISTEN
Client sends SYN — 'can we talk? I start at seq 0'
Client → CLOSED to SYN_SENT
Server replies SYN-ACK — 'yes, my seq is 0, expecting 1'
Server → LISTEN to SYN_RCVD
Client ACKs — 'got it, sending 1'
Both → ESTABLISHED
Client sends data (PSH) — 68 bytes of payload
payload consumed on server
Server ACKs data — 'received 68 bytes, next 69'
window slides forward
Client sends FIN — 'I have no more data'
Client → FIN_WAIT_1
Server replies ACK + FIN — 'acknowledged, closing too'
Server → CLOSE_WAIT then LAST_ACK
Client sends final ACK — connection closed
both → CLOSED