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
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Introduction to Operating Systems.
Lesson complete
Earn the 3 college credits for Introduction to Operating Systems
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Network Sockets →← 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 →
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.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Compare: Linux vs Operating Systems
Why take it here
Why students take Introduction to Operating Systems with UPI Study
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.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →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?
Which port numbers do common internet protocols use?
What happens, protocol by protocol, when a browser loads a web page?
What does the Content-Length header do in HTTP?
About the Introduction to Operating Systems course
How many college credits is Introduction to Operating Systems?
How much does Introduction to Operating Systems cost and what is included?
Which universities accept UPI Study credits?
How long does Introduction to Operating Systems take?
How are the exams done?
How do my credits reach my college?
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
3 credits · NCCRSEnroll →