What you'll learn
Quick Answer
DNS turns the name into an IP address, TCP opens a reliable connection with a three-way handshake, TLS encrypts it, then HTTP carries the request and response. TCP guarantees delivery and order; UDP does not, which is why video calls use UDP.
Layers, and why they exist
Networking is split into layers so each one solves a single problem and can be replaced independently. The practical four:
- Application — HTTP, DNS, SMTP. What the data means.
- Transport — TCP or UDP. Getting data between programs, reliably or not.
- Internet — IP. Getting packets between machines across networks.
- Link — Ethernet, Wi-Fi. Moving bits over one physical hop.
The benefit is that HTTP does not care whether you are on Wi-Fi or fibre, and Wi-Fi does not care whether you are loading a page or a video call. Switching from Wi-Fi to mobile data changes the bottom layer while everything above continues unchanged.
The OSI model has seven layers and appears in exams; the four-layer model above describes what actually runs.
Step 1: DNS turns a name into an address
You type priodemy.com, but packets need an IP address. DNS is the lookup.
The resolver checks caches first — the browser's, the operating system's, then your ISP's. On a miss it asks a root server which servers handle .com, asks those which handle priodemy.com, and asks that authoritative server for the address.
Results are cached according to their TTL, which is why a DNS change takes time to propagate and why the site may work for you and not for a friend during a migration.
DNS is usually the reason "the internet is down" while a direct IP still works. It also matters for debugging: if a name does not resolve, nothing above this step will ever happen.
Step 2: TCP opens a connection
With an address, TCP establishes a connection using a three-way handshake:
- Client sends SYN — "I want to connect, my sequence number is X".
- Server replies SYN-ACK — "acknowledged, mine is Y".
- Client sends ACK — "acknowledged".
That is one full round trip before any data moves, which is why latency matters so much on distant servers.
What TCP then guarantees is substantial: every byte arrives, in order, exactly once. It numbers segments, acknowledges them, retransmits what is lost, and reassembles out-of-order arrivals. It also adjusts sending rate to avoid overwhelming the network — congestion control.
All of that is why you never think about packet loss when loading a page.
Steps 3 and 4: TLS, then HTTP
For an https:// URL, TLS negotiates encryption over the TCP connection: agree on a cipher, the server presents its certificate, the client verifies it against trusted authorities, and both derive session keys.
Certificate verification is the part that matters — it is what stops an impostor serving you a convincing fake. A browser warning about an invalid certificate means exactly that check failed.
Then HTTP finally sends the request:
GET /blog HTTP/1.1
Host: priodemy.com
Accept: text/html
The server responds with a status line, headers and the body. The browser parses the HTML and issues further requests for CSS, images and scripts — each potentially needing its own connection, which is why reducing the number of requests speeds up pages.
See HTTP vs HTTPS for what encryption does and does not protect.
TCP vs UDP
UDP is the alternative transport, and the comparison is a standard interview question.
UDP has no handshake, no acknowledgements, no retransmission and no ordering. It sends packets and hopes. That sounds strictly worse until you consider a video call: if a packet carrying 20 milliseconds of audio is lost, retransmitting it is pointless — by the time it arrives, that moment has passed. A brief glitch is better than a growing delay.
So: TCP for correctness — web pages, file transfers, email, databases. UDP for timeliness — voice and video, live streaming, online games, and DNS queries, which are small enough to simply retry.
Worth knowing: HTTP/3 runs over QUIC, which is built on UDP and implements its own reliability with faster connection setup. So the neat split is blurring — but the underlying trade-off between guaranteed delivery and low latency is permanent.
