TCP is a Layer 4 transport protocol that addresses applications through ports and multiplexes sessions. It provides connection-oriented, reliable communication with sequencing, acknowledgments, retransmission, and flow control. section 22.0 section 22.2.1
TCP communication follows three stages: connection establishment, data exchange, and connection termination. Hosts establish a connection before sending data, then terminate it after exchanging the required information. section 22.2.1
TCP’s mechanisms turn a stream of segments into controlled, dependable delivery:
- The three-way handshake uses SYN, SYN-ACK, and ACK segments; these establishment segments carry no application data. section 22.2.1
- Sequence numbers order data, while acknowledgments identify the next sequence number expected by the receiver. section 22.2.1
- Missing acknowledgments cause retransmission, allowing a lost segment to be sent again. section 22.2.1
- The Window Size field provides flow control by limiting how much data the sender transmits before waiting for acknowledgment; the rate can change dynamically. section 22.2.1
- FIN and ACK flags coordinate connection termination after data exchange. section 22.2.1
A reliable web connection
When a client requests a file from a server, the client first sends SYN, the server replies with SYN-ACK, and the client completes the handshake with ACK. The file then travels in sequenced segments; acknowledgments confirm progress, and a missing acknowledgment triggers retransmission. Once both devices finish, FIN and ACK segments close the connection. section 22.2.1
Figure 22.4 The format of the TCP header. Like the IPv4 header, it is a minimum of 20 bytes in size but can be up to 60 bytes if Options are included.
Use the TCP header diagram to locate ports, flags, sequence and acknowledgment information, Window Size, and the variable header length. section 22.2.1




