How TCP works
TCP turns IP's best-effort packets into a reliable, ordered byte stream. It sets up a connection with a three-way handshake, numbers every byte, re-sends anything not acknowledged and closes cleanly with FIN.
Layer: Transport (OSI layer 4) · Port: - · Transport: - · Format: 20-byte header + data · Standard: RFC 9293
TCP packet flow
- TCP Client → Web Server: 52344 → 80 [SYN] Seq=0
- TCP Web Server → Client: 80 → 52344 [SYN, ACK] Seq=0 Ack=1
- TCP Client → Web Server: 52344 → 80 [ACK] Seq=1 Ack=1
- TCP Client → Web Server: [PSH, ACK] Seq=1 Len=420
- TCP Web Server → Client: [ACK] Ack=421
- TCP Client → Web Server: [FIN, ACK]
- TCP Web Server → Client: [FIN, ACK]
- TCP Client → Web Server: [ACK] - closed
Other protocols: Ethernet · IP · IPv6 · UDP · ICMP · ARP · DHCP · DNS · BGP · NTP · IGMP