Network Protocols, Explained

UPI Study › Courses › Introduction to Operating Systems › Free lessons › Lesson 8.4 Free with a free account

Network Protocols

Introduction to Operating Systems · Chapter 8: The Internet, Connectivity, and Network OperationsSection 8.4 · lesson 65 of 839 min · free with a free account

← Internet PacketsNext lesson: Network Sockets →

A free account plays all of Chapter 1 and 3 more lessons of Introduction to Operating Systems. Create a free account →

Earn 3 college credits for Introduction to Operating SystemsRecommended for credit by NCCRS · Computer Science 354 · self-paced · one payment, lifetime access

In this lesson

How agreed rules, layers, and ports let different computers talk.

  • Explain the three things every protocol settles
  • Match common application protocols to their layers and well-known ports
  • Trace the protocols used to load a web page, in order
  • Calculate an HTTP Content-Length value from a message body

Free study notes

Get this lesson's notes by email

The key points and 4 practice questions with answers, in your inbox. One email, free.

One email. Unsubscribe in one click.

Transcript

Everything said in the video, section by section (1,118 words). Read along, or search it.

Opening Analogy

The Unwritten Script of a Phone Order

When you phone a pizza shop, you both know how the call goes. You say hello. They ask what you'd like. You order, they read it back, you say thanks, and you hang up. Nobody wrote this script down for you, yet it works, because both sides follow it. Computers need the same thing, but written down exactly, because a computer can't guess what a friendly pause means. These written scripts are called protocols.

Definition

Syntax, Meaning, and Order and Timing

A protocol is an agreed set of rules for how two computers talk. Think of diplomats following a fixed ceremony, so nothing is misunderstood. Every protocol settles three things. Syntax: the exact format of a message, such as which bytes are the address, and which are the data. Meaning: what each message or code means. When a web server answers 200, it means: here is your page. And order and timing: who speaks first, who answers, and what to do after a silence. Because the rules are public standards, a Windows laptop, a Linux server, and a phone can all talk, without knowing anything about each other's insides.

Protocol Layers

From HTTP Down to Ethernet

Every protocol sits at a layer, from lesson 7.2, and many work together. At the top, the application layer is what programs say: HTTP for web pages, DNS for names, SMTP for mail, DHCP for addresses, and SSH for remote logins. Below it, the transport layer picks which program, and how carefully to deliver: TCP or UDP. The network layer picks the computer and the route: IP, plus ICMP, which carries error reports and ping. And the link layer handles only the next hop: Ethernet or Wi-Fi. Each layer uses the one below it.

Well-Known Ports

Where Each Protocol Listens

Each of these runs over TCP or UDP, and listens on a well-known port, so a client knows where to knock. Web pages use HTTP on port 80, and HTTPS, the encrypted form from lesson 7.5, on port 443. DNS answers on port 53, usually over UDP. DHCP uses ports 67 and 68, also over UDP. Mail between servers uses SMTP, on port 25. Reading mail uses IMAP, on 143, or POP3, on 110. SSH, an encrypted remote login, uses port 22. The older, unencrypted FTP copies files on port 21. And NTP keeps clocks in step, on port 123.

Ports and Safety

Firewalls Block Protocols by Port

Ports matter for safety too. A firewall, from lesson 9.3, can allow or block a protocol by its port. That's why a school network might let web pages through, but block SSH. The numbers are conventions. A server can be set to listen on another port, but clients expect the standard ones.

Quick Check

Coffee Shop Wi-Fi with Three Open Ports

Quick check. A coffee shop's Wi-Fi lets only three ports out: 53, 80, and 443. A customer tries three things. Which one fails? Pause, and decide. The mail app fails. It fetches messages over IMAP, which uses port 143, and port 143 isn't on the list. HTTPS goes out on 443, and DNS on 53, so both of those work.

First Steps

DHCP and DNS Come First

Two protocols run before anything else. When Sam, who runs a small online bakery, joins the shop's Wi-Fi, the laptop has no address yet. So it shouts a DHCP request: I have no address! A DHCP server answers with an IP address, a gateway, and a DNS server to use. Then Sam types the shop's name. The network layer routes only by number, from lesson 7.4, so DNS asks a name server for the matching IP address. Each answer is needed before the next step. Only now can TCP and HTTP begin.

Step by Step

Eight Messages to Load a Page

Now the page itself. Several protocols take turns, and each message is allowed only after the one before. Steps one and two are DNS. Where is shop dot example? It's 192.0.2.7. Steps three to five are TCP's handshake, from lesson 7.6: SYN, SYN-ACK, ACK. Step six is HTTP: get slash cakes. Step seven is the answer: 200, OK, plus the page. And step eight: TCP closes the connection. A protocol conversation is just this: a fixed sequence of messages.

Code Walkthrough

Building an HTTP Request by Hand

Classic HTTP, version 1.1, is plain text. A short Python program builds a request by hand, and reads a reply, with no network at all. The request is a first line, with the method, the path, and the version. Then a few header lines of extra facts. Then a blank line ends it. The answer starts with a status line. 200 means success, and 404 means not found. Then come headers, a blank line, and the body. Look at the header Content-Length: 11. The body, Fresh bread, really is 11 bytes, and the program checked it. That length is part of the rules. It tells the receiver exactly where the message ends. Without it, a receiver couldn't know whether more was still coming. Newer versions, HTTP/2 and HTTP/3, carry the same requests and replies, packed into binary frames.

Quick Check

Counting Bytes for Content-Length

Quick check. A server's reply body is exactly the words Hot cross buns, with single spaces, and nothing else. What must its Content-Length header say? Pause, and predict. Fourteen. Content-Length counts bytes, and every character here is one byte, spaces included. Hot is three, a space, cross is five, a space, and buns is four. Three, plus one, plus five, plus one, plus four, makes fourteen. Twelve forgets the two spaces, and three counts words. The receiver needs bytes, to know exactly where the body ends.

Who Writes Rules

IETF Standards Published as RFCs

Who writes the rules? Internet standards come mostly from an open group, the Internet Engineering Task Force. They're published as numbered documents called RFCs, short for Requests for Comments, and anyone can read them for free. The rule is simple. If everyone follows the same RFC, any two systems can talk. The operating system plays its part, too. The network code inside the kernel implements TCP and IP. Programs, like browsers and mail apps, implement the application protocols on top. They reach the kernel's code through sockets, the topic of lesson 8.5.

Troubleshooting Story

A Tablet with the Wrong Name Server

Back to Sam. A new tablet wouldn't open the shop page at a school. Ivy, who looks after the computers there, ran through the list. Did it get an address? That's DHCP. Can it turn names into numbers? That's DNS. Does port 443 work? That's HTTPS. The DNS check failed. The tablet was set to the wrong name server, and the fix took one setting. That's the habit to keep: when something fails, ask which protocol, and which port. Names failing while numbers work points at DNS.

Key Takeaways

Protocols, Ports, and Page Loads Reviewed

To recap. A protocol settles syntax, meaning, and order and timing. Each protocol has a layer, a job, and usually a well-known port. DHCP hands a device its address, and DNS turns a name into a number. A page load goes DNS, then TCP's handshake, then HTTP. And Content-Length tells the receiver where a message ends.

About Introduction to Operating Systems at UPI Study

Introduction to Operating Systems (Computer Science 354) is a self-paced online course of 83 video lessons in 10 chapters, from what an operating system does and process scheduling to concurrency, memory, devices, file systems, networks, the internet, security and virtual machines. It carries a NCCRS credit recommendation for 3 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Compare: Linux vs Operating Systems

Why take it here

Why students take Introduction to Operating Systems with UPI Study

What happens under every app you runIntroduction to Operating Systems explains the software that runs a computer: processes and scheduling, threads and synchronization, deadlock, memory and paging, devices and storage, file systems, networking, security and virtualization. It suits computer science and information technology degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Introduction to Operating Systems carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Network Protocols

What is a network protocol in simple terms?
A network protocol is an agreed set of rules for how two computers exchange messages. It settles three things: syntax, the exact format of each message; meaning, what each message or code stands for; and order and timing, which says who speaks first and what to do after a silence. Because the rules are public standards, a Windows laptop, a Linux server, and a phone can all communicate.
Which port numbers do common internet protocols use?
Common protocols listen on well-known ports so clients know where to connect. HTTP uses port 80 and HTTPS uses 443. DNS uses 53, usually over UDP, and DHCP uses 67 and 68. SMTP mail between servers uses 25, IMAP uses 143, and POP3 uses 110. SSH uses 22, FTP uses 21, and NTP uses 123. A server can listen on another port, but clients expect these.
What happens, protocol by protocol, when a browser loads a web page?
Loading a page is a fixed sequence of protocol messages. If the device has no address yet, DHCP first supplies an IP address, a gateway, and a DNS server. Next, DNS turns the site's name into an IP address. Then TCP opens a connection with its handshake of SYN, SYN-ACK, and ACK. HTTP sends a GET request, the server answers 200 OK with the page, and TCP closes the connection.
What does the Content-Length header do in HTTP?
Content-Length tells the receiver exactly how many bytes the message body holds, so it knows where the message ends. It counts bytes, not words, and in plain ASCII text every character, including a space, is one byte. A body of Hot cross buns is therefore 14 bytes: three, one space, five, one space, and four. Without it, a receiver could not tell whether more data was still coming.

About the Introduction to Operating Systems course

How many college credits is Introduction to Operating Systems?
Introduction to Operating Systems (Computer Science 354) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Introduction to Operating Systems cost and what is included?
$250, paid once, with lifetime access: all 83 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Introduction to Operating Systems take?
It is self-paced with no deadlines. The 83 lessons total about 10 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 3 credits in Introduction to Operating Systems.

83 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Updated

Introduction to Operating Systems
3 credits · NCCRS
Enroll →