TCP/IP Model
Also Known As
network stack
OSI model
internet protocol suite
TL;DR
The four-layer model (Link, Internet, Transport, Application) that describes how data is packaged, routed, and delivered across the internet.
Explanation
The TCP/IP model layers from bottom to top: Link (Ethernet, WiFi — physical transmission), Internet (IP — addressing and routing between networks), Transport (TCP/UDP — end-to-end delivery), Application (HTTP, DNS, SMTP — what applications speak). Each layer adds a header encapsulating the layer above. Understanding TCP/IP explains why HTTP needs TCP (reliable), why UDP suits video (fast, loss-tolerant), and why IP routing works across heterogeneous networks.
Diagram
flowchart TD
subgraph Application
HTTP2[HTTP] & DNS2[DNS] & SMTP2[SMTP]
end
subgraph Transport
TCP2[TCP] & UDP2[UDP]
end
subgraph Internet
IP2[IP Routing]
end
subgraph Link
ETH2[Ethernet / WiFi]
end
Application -->|Data| Transport -->|Segments| Internet -->|Packets| Link -->|Frames| WIRE[Physical Medium]
style Application fill:#1f6feb,color:#fff
style Transport fill:#238636,color:#fff
style Internet fill:#d29922,color:#fff
style Link fill:#6e40c9,color:#fff
Common Misconception
✗ The OSI 7-layer model is how the internet actually works — TCP/IP's 4-layer model is the practical implementation; OSI is a conceptual reference model.
Why It Matters
Understanding TCP/IP explains connection timeouts, why HTTPS adds TLS between TCP and HTTP, and how tools like tcpdump and Wireshark capture traffic at different layers.
Common Mistakes
- Confusing TCP (reliable, ordered, connection-oriented) with UDP (unreliable, unordered, connectionless).
- Not understanding that IP addresses are Layer 3 (Internet) and MAC addresses are Layer 2 (Link) — they serve different scopes.
- Assuming HTTP requires TCP — HTTP/3 uses QUIC over UDP for improved performance.
- Not accounting for TCP connection overhead — each new TCP connection requires a 3-way handshake adding round-trip latency.
Code Examples
✗ Vulnerable
# Ignoring TCP connection cost — new connection per request:
# PHP script making 100 HTTP calls with new connections each time:
for ($i = 0; $i < 100; $i++) {
$ch = curl_init($url);
curl_exec($ch);
curl_close($ch); // Connection closed — 100 TCP handshakes
}
✓ Fixed
# Reuse connections with persistent handles:
$mh = curl_multi_init();
$handles = [];
for ($i = 0; $i < 100; $i++) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); // HTTP/2 multiplexing
$handles[] = $ch;
curl_multi_add_handle($mh, $ch);
}
// HTTP/2 multiplexes all 100 requests over one TCP connection
Tags
🤝 Adopt this term
£79/year · your link shown here
Added
15 Mar 2026
Edited
22 Mar 2026
Views
25
🤖 AI Guestbook educational data only
|
|
Last 30 days
Agents 0
No pings yet today
Amazonbot 1
Amazonbot 9
Perplexity 4
Google 2
Ahrefs 2
SEMrush 2
Also referenced
How they use it
crawler 18
crawler_json 1
Related categories
⚡
DEV INTEL
Tools & Severity
🔵 Info
⚙ Fix effort: Medium
⚡ Quick Fix
Understand the stack: Application (HTTP) → Transport (TCP) → Internet (IP) → Link (Ethernet) — PHP operates at the Application layer; TCP connection reuse via keep-alive reduces per-request overhead
📦 Applies To
any
web
cli
🔗 Prerequisites
🔍 Detection Hints
New TCP connection per HTTP request instead of keep-alive reuse; no understanding of why HTTPS adds latency
Auto-detectable:
✗ No
⚠ Related Problems
🤖 AI Agent
Confidence: Low
False Positives: High
✗ Manual fix
Fix: Low
Context: File