Skip to main content
TCP

Transmission Control Protocol

Active

Connection-oriented transport protocol providing reliable, ordered, error-checked delivery of data between applications over IP networks.

Transport LayerRFC 92931981Internet Standard

In one line

TCP is the internet's primary transport protocol, providing reliable byte-stream delivery between applications. Defined in RFC 9293, it establishes connections via a three-way handshake, guarantees ordered delivery through sequence numbers, implements flow control with sliding windows, and handles congestion through algorithms like slow start and congestion avoidance. TCP operates at Layer 4 and carries HTTP, SSH, SMTP, and most application-layer protocols.

Quick Reference

FieldSizeDescription
Source Port16 bitsSender's port number (0–65535)
Destination Port16 bitsReceiver's port number
Sequence Number32 bitsPosition of first data byte in this segment
Acknowledgment32 bitsNext sequence number expected from sender
Data Offset4 bitsSize of TCP header in 32-bit words
Flags9 bitsSYN, ACK, FIN, RST, PSH, URG, ECE, CWR, NS
Window Size16 bitsReceive window size for flow control
Checksum16 bitsError detection for header + data
Urgent Pointer16 bitsOffset of urgent data (if URG flag set)

Key Characteristics

Connection-oriented

Three-way handshake (SYN → SYN-ACK → ACK) before data transfer.

Reliable

Guarantees delivery via acknowledgments and retransmission.

Ordered

Sequence numbers ensure bytes arrive in the correct order.

Flow Controlled

Sliding window prevents sender from overwhelming receiver.

Message Format

Request
http
TCP Three-Way Handshake:

Client → Server:  SYN, Seq=0
Server → Client:  SYN-ACK, Seq=0, Ack=1
Client → Server:  ACK, Seq=1, Ack=1

[Connection established – data transfer begins]
Response
http
TCP Connection Teardown:

Client → Server:  FIN, Seq=100, Ack=200 Server → Client:  ACK, Seq=200, Ack=101
Server → Client:  FIN, Seq=200, Ack=101
Client → Server:  ACK, Seq=101, Ack=201 
[Connection closed]

Implementations

linuxsince Kernel 1.0built-in
macossince BSDbuilt-in
windowssince Windows 95built-in
freebsdsince FreeBSD 1.0built-in
iosbuilt-in
androidbuilt-in

Related protocols