How Engineers Use Electrons To Let You Stream Netflix

Melissa Mullen
simple CS
Published in
9 min readSep 1, 2020

The internet allows humans to communicate with each other, despite large physical separation, seemingly instantaneously. We often forget that what enables human communication is computer communication, also called telecommunications or networking.

Use of the word “Google” over time.

Modern advancements in telecommunications are impressive. It is truly incredible that information can travel thousands of miles through the air and display itself on a laptop in a matter of seconds. How is this possible?

The OSI Model

The approach I have found most useful for answering this question is exploring the Open Systems Interaction (OSI) Model. The OSI Model is a high-level, conceptual explanation of telecommunications. It is made up of seven abstraction layers. An abstraction layer is a group of common functionality that hides details that would clutter understanding. For example, the colors of the rainbow are abstraction layers . When we think of the color blue, we include navy blue, sky blue, turquoise, cyan, etc. These additional colors are under the “umbrella” of the color blue, so blue is the abstraction layer.

The OSI Model.

In the OSI Model, each abstraction layer has an associated communication protocol. A communication protocol is a set of rules or standards that allow computers to communicate. It defines types of messages a computer can send and types of responses the other computer can send back. The group of protocols associated with the layers of the OSI Model is called the Internet Protocol Suite.

For computers to communicate, ultimately their applications need to communicate. If you aren’t familiar with how applications run on a computer, I suggest you skim this article before continuing.

Note that the Session/Presentation is considered part of the OSI Model, but not the Internet Protocol Suite. As such, we will not cover it in this article.

Protocol Data Units

When computers communicate, they send each other pieces of data called Protocol Data Units (PDUs). PDUs are made up of several sub-PDUs. Each sub-PDU is associated with a layer of the OSI model, and contains both a header and a payload. A header is data containing information about the payload. The payload is the data that is the actual intended message. The payload is referred to as a Service Data Unit (SDU).

When a computer wants to send application data to another computer, it creates a PDU, using the following steps, in a process called packet encapsulation:

  1. Add the application data to the Application SDU.
  2. Tack on an application header to the Application SDU, making it an Application PDU.
  3. Wrap the Application PDU into a sub-PDU for each layer of the OSI Model. In the context of the entire PDU, the Application PDU is referred to as data.
The PDU at the Transport Layer.

To begin Step 3 of packet encapsulation, the Application PDU is added to the Transport SDU, at which point a transport header is tacked on, making it a Transport PDU. In the context of the entire PDU, the Transport PDU is referred to as a segment.

Packet encapsulation continues with the Transport PDU getting placed into the Network SDU, at which point a network header it tacked on, making it a Network PDU. In the context of the entire PDU, the Network PDU is referred to as a packet.

The PDU at the Network Layer.

The final step of packet encapsulation involves the network PDU getting placed into the Physical SDU, at which point a physical header is tacked on, making it a Physical PDU. In the context of the entire PDU, the Physical PDU is referred to as a bit.

The PDU at the Physical Layer.

With this, the computer has completed the packet encapsulation process and successfully created a PDU that can be sent to another computer.

Now that we understand how a PDU is constructed from sub-PDUs associated with layers of the OSI Model, let’s explore each sub-PDU in more detail. For the rest of this section, we will refer to the computer requesting (receiving) information as the client, and the computer sending information as the server. During the exchange of information between computers, the client sends requests and the server sends responses.

Client-server peer communication.

The client sub-PDUs (layers) can only communicate with the corresponding server layer (peer) via their associated OSI layer communication protocol. The communication protocol defines commands that the client can use in its request, as well as status codes and headers that the server can use in its response.

Application PDU

The application layer performs its functions by issuing service requests to the transport layer. One such request might be a GET request, requesting that the transport layer get application data from a server.

Common application communication protocols include:

  • Hypertext Transfer Protocol (HTTP) : web browser applications (Chrome, Firefox, Safari, etc.)
  • Domain Name System (DNS) : DNS name (www.google.com) to IP address (172.217.12.132) translation applications
  • Secure Shell (SSH) : command line applications

Transport PDU

The transport layer responds to service requests from the application layer, and performs its responsibilities by issuing service requests to the network layer.

The transport layer is first and foremost responsible for establishing a connection between the client and server, which it does using MAC addresses, IP address, and ports.

A Media Access Control address (MAC address) is a unique identifier assigned to a Network Interface Controller (NIC). An NIC is a piece of hardware in your computer that allows it to communicate with other computers. An IP address is a unique number assigned to each computer on the network (we’ll get to what a network is later, but for now, know that it is a group of computers that can communicate). A port is just a number that identifies a particular process on a computer’s operating system. Which port number is chosen tells us which communication protocol is being used.

You can think of a port as the address of a house in a city. In this analogy, the MAC address is the city zip code, the computer is the city itself containing thousands of homes (ports), the IP address is a unique number assigned to all families who opted into letter writing, the OSI Model layer is the ethnicity of the family that lives in the house (port), and the communication protocol is the language the family speaks.

Both the client and the server must have a port for the communication protocol. (If only one family in the city speaks French, they cannot write letters to any other families!)

To establish the connection, the transport layer of the client must initiate a handshake with the server. Handshaking is the agreement between a client and a server (via segments) that they will communicate using a particular communication protocol (“Do we want to write letters to each other in English?” “Yes.” “Great!”).

Once the handshake has occurred, the transport layer is responsible for sending transport segments containing application data. Transport PDUs are called “segments” because the application data is broken up among multiple PDUs if it is large. Some transport protocols (TCP) ensure that these segments arrive in order, and that all of them arrive, while others (UDP) lack this over-head.

Suppose the application layer issues a GET request via HTTP. Then the transport layer will receive a service request to get data from a server. The transport layer will initiate a handshake by sending a request to the network level. Then, server will start sending transport segments by sending requests to the network layer as well. The responses from the network layer will be combined by the transport communication protocol and returned to the application layer as an HTTP response from the server.

Common transport communication protocol include:

  • Transmission Control Protocol (TCP) : provides reliable, ordered packets
  • User Datagram Protocol (UDP) : provides unreliable, unordered packets

Network PDU

The network layer responds to service requests from the transport layer, and performs its functions by issuing service requests to the data link layer.

The network layer is responsible for routing through intermediate routers. There are millions of routers located all around the world. A router is a device that forwards network packets to other routers. Routing is the process of selecting the best path for network packets to follow. A useful analogy is to think of intermediate routers as flight lay-overs on your journey to your destination.

A visualization of routing a network packet from a client to a server.

When the network layer receives a request to send a transport segment to a server, it determines the best route for the segment to travel, and sends a request to the data link layer to propagate it.

The principle network communication protocol is:

  • Internet Protocol (IP)

Data Link PDU

The data link layer responds to service requests from the network layer, and performs its functions by issuing service requests to the physical layer.

The data link layer is responsible for minimizing collisions. When it receives a request from the network layer to propagate a transport segment along a particular path, it sends a request to the physical layer asking if there are other segments headed there already, and redirects the segment if necessary.

Physical PDU

The physical layer responds to service requests from the data link layer. It does this by translating the request from the data link layer into commands the hardware will understand.

When the physical layer receives a request from the data link layer inquiring about incoming segments to particular routers, it checks the physical hardware to determine the answer (measuring the current propagating through a wire, or radio waves in the air).

The Internet

Computer Networks

A computer network is a group of computers that are connected (for example, via Ethernet cables or WiFi radio waves). A Local Area Network (LAN) is a computer network that allows computers within a small area (house, office, university campus) to communicate.

A Wide Area Network (WAN) is a computer network covering a larger geographic area.

Wide Area Network (WAN)

You can begin to see how the Internet came to be if you connect more and more WANs to each other. The Internet is just a network of networks.

So What About Netflix?

Netflix is a streaming media service. This means you must be connected to the Internet in order to binge watch The Office at 2 am. Let’s find the electrons.

When you connect your laptop to your home WiFi, you are connecting to a router provided to you by some Internet Service Provider. All of the devices in your home connected to that router make up a LAN. The router is connected to a WAN, leased to you by the Internet Service Provider. That WAN is connected to more WANs, and more WANs, and ultimately to the WAN that Netflix itself is connected to. When you navigate to netflix.com, your computer initiates a handshake with the Netflix server. Exactly what route each transport segment (and ultimately, electrons!) of The Office will take is determined by the network layer of the PDU.

But don’t worry, because of some kick-ass engineering, those transport segments will make it there, and you can watch this guy all night long.

--

--