6. Communication Protocols
Learning Objectives
- Explain the purpose of a communication protocol and why layered models exist
- Map common protocols (Ethernet, IP, TCP, UDP, HTTP, TLS) to their correct OSI layer
- Compare TCP and UDP and identify which applications should use each
- Explain how HTTPS builds security on top of HTTP using TLS
- Distinguish protocols designed for wired networks from those designed for wireless networks
- Identify why protocol layering makes networks easier to design, extend, and troubleshoot
Quick Answer
A communication protocol is an agreed-upon set of rules that lets two devices exchange data correctly, covering everything from voltage levels and framing (at the physical/data link layer) to how a web browser requests a page (at the application layer). Real networks stack these rules in layers — commonly described by the OSI model — so that each layer only needs to worry about its own job: Ethernet handles local delivery, IP handles routing across networks, TCP or UDP handles end-to-end transport, and application protocols like HTTP or FTP handle what the data actually means. This layering is why you can swap Wi-Fi for Ethernet without changing how a web browser works — the layers above don't need to know what's happening below.
Why Layering Exists
Imagine one giant protocol responsible for everything from electrical signaling to displaying a web page — any change (new cable type, new encryption method) would force a redesign of the whole system. The OSI (Open Systems Interconnection) model splits this responsibility into seven layers, each communicating only with the layer directly above and below it through a well-defined interface. A protocol at one layer doesn't need to understand the internal details of protocols above or below it — it just needs to correctly hand off (or receive) data at its interface.
Why it matters: This is exactly why a laptop can switch from Ethernet to Wi-Fi mid-session (both are data link layer technologies) without the browser, TCP connection, or the website itself needing to change anything — the layers above the data link layer are unaffected.
Layer-by-Layer Protocol Roles
- Physical layer: Defines voltage levels, cabling, connectors, and radio characteristics — the literal bits-on-the-wire (or bits-in-the-air) layer.
- Data link layer: Handles framing and error-free delivery of frames between two directly connected devices on the same network segment. Ethernet (IEEE 802.3) and Wi-Fi (IEEE 802.11) operate here, along with MAC addressing.
- Network layer: Routes packets between different networks. Internet Protocol (IP), in versions IPv4 and IPv6, is the fundamental protocol of the internet at this layer — it doesn't guarantee delivery, only best-effort routing based on IP addresses.
- Transport layer: Provides end-to-end communication between processes on different devices. TCP (Transmission Control Protocol) guarantees ordered, reliable delivery via acknowledgments and retransmission; UDP (User Datagram Protocol) sends datagrams with no delivery guarantee, prioritizing speed and low overhead instead.
- Session, presentation, and application layers: Handle connection management (session), data formatting and encryption (presentation — TLS/SSL, MIME), and the actual application-level exchange (HTTP for web pages, FTP for file transfer, SSH for secure remote login).
TCP vs UDP: The Central Transport-Layer Trade-off
TCP establishes a connection (the "three-way handshake"), numbers every byte sent, and retransmits anything the receiver doesn't acknowledge — guaranteeing that data arrives complete and in order, at the cost of extra overhead and latency. UDP sends datagrams with no handshake, no acknowledgment, and no retransmission — faster and lower-overhead, but the application must tolerate or handle lost or out-of-order packets itself.
Why it matters: File downloads, web pages, and email use TCP because losing or reordering data would corrupt the file. Live video calls, online gaming, and DNS lookups use UDP because a dropped video frame or a lost DNS query (which can simply be retried) is far less costly than the added latency TCP's guarantees would introduce.
Common misunderstanding: Students often assume UDP is simply "worse" than TCP. UDP is not inferior — it is the correct choice whenever low latency matters more than guaranteed delivery, which is precisely the trade-off real-time applications need.
Security: How HTTPS Builds on HTTP
HTTPS is HTTP layered on top of TLS (Transport Layer Security). When a browser connects to an HTTPS site: the server presents a certificate (verifying its identity and providing its public key), the browser and server negotiate a shared session key using that public key, and all subsequent HTTP traffic is encrypted with that session key. This is why the padlock icon in a browser indicates that eavesdroppers on the network cannot read the exchanged data, even though the underlying HTTP request/response structure is unchanged.
Key Terms
| Term | Definition | Related Concept |
|---|---|---|
| OSI model | Seven-layer reference model describing how network communication is organized | Layering, protocol stack |
| Ethernet (IEEE 802.3) | A data link layer protocol for wired local area networks | MAC address, CSMA/CD |
| Wi-Fi (IEEE 802.11) | A data link/physical layer protocol family for wireless local area networks | CSMA/CA, RF communication |
| IP (Internet Protocol) | Network layer protocol responsible for addressing and best-effort routing of packets | IPv4, IPv6, routing |
| TCP | Transport layer protocol providing reliable, ordered, connection-based delivery | Three-way handshake, retransmission |
| UDP | Transport layer protocol providing fast, connectionless, best-effort delivery | Real-time applications, DNS |
| TLS/SSL | Presentation-layer security protocol that encrypts data between two communicating parties | HTTPS, certificates |
| HTTP/HTTPS | Application layer protocol for transferring web content, with HTTPS adding TLS encryption | Web browsing, TLS |
| MAC address | A unique hardware address identifying a device's network interface at the data link layer | Ethernet, Wi-Fi |
Common Mistakes
Misconception: All network protocols exist at a single, undifferentiated level, so any protocol could theoretically replace any other. Why it's wrong: Protocols are specific to a layer with a specific job — Ethernet cannot replace TCP's reliability function, and TCP cannot replace Ethernet's job of physically delivering frames on a local segment. Correct understanding: The OSI model organizes protocols by function; each layer's protocols solve a distinct problem (framing, routing, reliable transport, application semantics), and a working network requires one working protocol at each necessary layer.
Misconception: UDP is an inferior, outdated version of TCP that should be avoided. Why it's wrong: UDP is deliberately simpler — no handshake, no acknowledgment, no retransmission — which is exactly the right trade-off for latency-sensitive applications like video calls and online gaming where waiting for a retransmitted packet would be worse than simply dropping it. Correct understanding: TCP and UDP each optimize for a different priority: TCP for guaranteed, ordered delivery; UDP for speed and minimal overhead. The right choice depends entirely on the application's tolerance for loss versus latency.
Misconception: HTTPS is a completely different protocol from HTTP, unrelated to it. Why it's wrong: HTTPS uses the exact same HTTP request/response structure and methods (GET, POST, etc.) — the only difference is that the connection is wrapped in TLS encryption before any HTTP data is exchanged. Correct understanding: HTTPS = HTTP + TLS. The application-layer semantics are identical; only the presentation-layer security wrapper is added.
Comparison and Connections
| Protocol | OSI Layer | Guarantees Delivery? | Typical Use |
|---|---|---|---|
| Ethernet | Data link | Frame-level error checking, not guaranteed delivery | Wired LANs |
| Wi-Fi | Data link/Physical | Frame-level acknowledgment on local hop | Wireless LANs |
| IP | Network | No (best-effort routing) | Internet-wide addressing/routing |
| TCP | Transport | Yes (ordered, reliable, retransmits) | Web pages, file transfer, email |
| UDP | Transport | No (fire-and-forget) | Video calls, gaming, DNS |
| HTTPS | Application + Presentation | Depends on TCP beneath it (reliable) + adds encryption | Secure web browsing |
Practice Questions
Recall
-
Name the seven layers of the OSI model in order, from physical to application. Answer guidance: Physical, Data Link, Network, Transport, Session, Presentation, Application.
-
Which OSI layer is Ethernet associated with, and what is its main job? Answer guidance: Data link layer; its main job is error-checked, framed delivery of data between two devices on the same local network segment, using MAC addressing.
Understanding
-
Explain why TCP is described as "connection-oriented" while UDP is "connectionless." Answer guidance: TCP establishes a session via a three-way handshake before exchanging data and maintains state (sequence numbers, acknowledgments) throughout; UDP simply sends datagrams with no setup, no ongoing session state, and no delivery confirmation.
-
Why can a laptop switch from Wi-Fi to Ethernet without breaking an active TCP connection to a website? Answer guidance: Wi-Fi and Ethernet are both data link layer protocols; because of OSI layering, the network, transport, and application layers above them don't depend on which specific data link technology is in use, so as long as the same IP address and route are maintained, the higher layers are unaffected. (In practice a true seamless handover also needs IP mobility support, but the principle of layer independence holds.)
Application
-
A company is building a live video conferencing application. Should the video stream use TCP or UDP, and why? Answer guidance: UDP, because video conferencing prioritizes low latency; if a packet (video frame) is lost, it's better to skip it and keep the stream flowing smoothly than to pause and wait for TCP to retransmit it, which would cause noticeable lag.
-
A user visits a banking website and sees a padlock icon in their browser. Explain, layer by layer, what protocol is doing the encryption and how the secure session was established. Answer guidance: TLS operates at the presentation layer, encrypting the data before it's handed to HTTP (application layer). The server sends a certificate containing its public key; the browser verifies it and negotiates a shared session key; from then on all HTTP traffic is encrypted with that key — this combination is what makes the connection "HTTPS."
Analysis
-
Compare the consequences of packet loss for a TCP-based file download versus a UDP-based video call. Answer guidance: In a TCP file download, lost packets are automatically retransmitted and the file arrives complete and correct, though possibly with some added delay. In a UDP video call, lost packets are simply not resent — the receiver either interpolates/conceals the gap or shows a brief glitch, but the call keeps flowing in real time rather than stalling to wait for a retransmission.
-
Explain why it would be architecturally awkward to build a single protocol that handled both physical signaling and application-level meaning (like HTTP) in one unified layer. Answer guidance: A single unified protocol would need to be redesigned every time either end changed — a new cable type would require rewriting web-page-serving logic, and a new web feature would require re-certifying physical hardware. Layering isolates these concerns so each can evolve independently (e.g., Wi-Fi and Ethernet can be swapped without touching HTTP, and HTTP can evolve to HTTP/2 or HTTP/3 without changing the underlying cabling).
FAQ
Why does the internet use so many different protocols instead of just one? Different tasks need fundamentally different guarantees and trade-offs — reliable ordered delivery (TCP) versus low-latency delivery (UDP), local framing (Ethernet/Wi-Fi) versus global routing (IP). Layering multiple specialized protocols lets each one be optimized and evolved independently, rather than forcing one protocol to compromise on everything at once.
What's the practical difference between IPv4 and IPv6? IPv4 uses 32-bit addresses (about 4.3 billion possible addresses), which have been effectively exhausted given the number of internet-connected devices. IPv6 uses 128-bit addresses, providing an astronomically larger address space, along with some efficiency and security improvements built into the protocol from the start.
Why do some protocols (like DNS) use UDP even though reliability seems important? DNS queries are small, and if a response is lost, the client can simply resend the (very fast, very cheap) query rather than pay the overhead of establishing a full TCP connection for a single small request. For larger DNS responses or certain zone transfers, DNS does fall back to TCP.
Is Wi-Fi a "wireless version of Ethernet"? They're closely related in role (both are data link layer LAN technologies) but use different media access methods: Ethernet historically used CSMA/CD (Collision Detection), while Wi-Fi uses CSMA/CA (Collision Avoidance) because a wireless device often can't reliably detect a collision while transmitting, so it tries to avoid one instead.
Do I need to memorize every OSI layer's protocols for exams? Focus on understanding what problem each layer solves and being able to place a handful of common, real protocols (Ethernet, IP, TCP, UDP, HTTP/HTTPS) at their correct layer — that conceptual mapping is what's actually tested, far more often than obscure protocol names.
Quick Revision
- A communication protocol is an agreed rule set for how two devices exchange data
- The OSI model organizes protocols into seven layers: Physical, Data Link, Network, Transport, Session, Presentation, Application
- Ethernet and Wi-Fi operate at the data link layer; IP operates at the network layer
- TCP is connection-oriented and reliable (handshake, acknowledgment, retransmission); UDP is connectionless and fast
- Use TCP when data integrity matters (files, web pages); use UDP when latency matters more (video calls, gaming, DNS)
- HTTPS = HTTP + TLS; TLS adds encryption at the presentation layer without changing HTTP's semantics
- MAC addresses identify devices at the data link layer; IP addresses identify them at the network layer
- Layering allows swapping technologies at one layer (Wi-Fi vs. Ethernet) without affecting layers above
- IPv4 addresses are 32-bit and exhausted; IPv6 addresses are 128-bit with a vastly larger address space
- Protocol choice always reflects a trade-off, most commonly reliability versus latency
Related Topics
Prerequisites: Basics of Communication Systems, Digital Communication, basic networking concepts
Related Topics: Wireless Communication, Digital Communication, Signal Processing in Communication
Next Topics: Wireless Communication, Satellite Communication, Fiber Optic Communication