TCP
TCP (Transmission Control Protocol) is a connection-oriented, reliable, ordered transport-layer protocol, establishing connections with a three-way handshake and providing sliding-window flow control and ACK-based acknowledgment.
Purpose
It provides reliable data transfer that arrives complete and in order, fitting file transfers and the Web.
Mechanism
A three-way handshake sets up the connection (SYN, SYN-ACK, ACK); a four-way close tears it down. Data is sequence-numbered and acknowledged by the receiver. Flow control uses a sliding window; congestion control uses slow start and AIMD. Retransmission happens on timeout. The state machine has 11 states.
Use cases
- HTTP/HTTPS web transport
- SSH remote login
- SMTP mail transfer
- File transfer (FTP/SFTP)
Examples
- Input
SYN seq=100OutputSYN-ACK seq=200 ack=101The three-way handshake
Common errors
- TIME_WAIT buildup exhausts ports
- Tune tcp_tw_reuse or use a connection pool
Related terms
UDP
UDP (User Datagram Protocol) is a connectionless, unreliable, unordered transport-layer protocol with low overhead and minimal delay, suited to real-time and broadcast traffic. GLOSSARY
Socket
A socket is a network communication endpoint identified by (protocol, local IP, local port, remote IP, remote port), serving as the interface between the application and transport layers. GLOSSARY
Port
A port is a transport-layer 16-bit address (0-65535) that distinguishes multiple network applications on one host; combined with the IP address it forms a socket. GLOSSARY
TLS
TLS (Transport Layer Security) provides encryption, integrity, and authentication at the transport layer; it replaced SSL and underpins HTTPS, SMTPS, and more. GLOSSARY