Alterna · учебный материал

How Data Travel

Data transmission: client server, packages, TCP/IP, DNS, HTTP/HTTPS. uploading web page step by step. Interactive lesson.

Что в этом материале

Содержание и основные понятия

Back to the table of contents
Alterna · Chapter 4 · page 4.2
How Data Travel
You inject into the browser.
google.com
- and after a fraction of a second, there's a search line on the screen. But what happened in those moments? How did your request get to a server in another country and come back? On this page, you'll see the entire path of data from pressing the key to downloading the page.
In chapter 3, you learned that the operating system has
Network Walls
What happens when a browser sends a request to a server?
The answer lies in
Protocols
- a set of rules by which the devices understand each other. As a post office, you need to know the address (IP), write the envelope (pack) correctly, and send it through the post office (passer). This is where you can figure out how this process works from beginning to end.
GEF · Basic
PLF · Infred
01
Client server: Who's serving who?
Main model of interaction on the Internet: one requests, the other answers.
GEF
Two roles: client and server
Client
– A program or device that requests data (browser, postal client, mobile app).
The server
– a program or computer that stores data and responds to clients' queries.
💻
Client
Similar: restaurant visitor
Orders a dish (sends a request) but does not prepare it itself, waits for the cook to bring it in. Examples: browser, Telegram, online game.
🖥️
The server
An analogy: restaurant kitchen
Takes order, prepares and delivers. Works 24/7, serves thousands of clients. Examples are web server, mail server, game server.
Request-response principle
The client sends the request
- For example, "Show me the Google.com page."
Request travels online
- through the routers, the providers, the main channels.
The server receives the request.
- process it (seeing for a page, checking his license).
The server sends the answer.
- returns the XML code of the page, the pictures, the video.
Client gets the answer.
- browser displays the page on the screen.
Important
One computer can be both a client and a server. When you watch YouTube, you're a client. When downloading photos into social media, you are a client, but the social media server takes your picture and keeps it.
02
Packages: How data are divided into parts
Big files don't fly all of them -- they break into little bags.
GEF
PIF
Why do you need bags?
Imagine you're sending a book to a friend by mail. Instead of one heavy package, you take a book into chapters and you send it to each chapter separately. If one chapter gets lost, you'll ask her to send it, not the whole book.
The Internet also works: data are broken down into
Packages
- small blocks with headlines.
What's inside the bag?
Each package consists of two parts:
Heading
- Service information: sender's IP address, recipient's IP address, package number, reference amount (to verify integrity).
Data
is a piece of useful information (file part, page piece, video piece).
INTRODUCTION
IP addresses, number, control
Data
File Fragment, HTML, Video
Figure 1.
Network package structure: title(s) + data (useful information)
How are the bags getting back together?
Every package has
Number
When all the packages reach the recipient, they gather in the right order, like a puzzle. If a package is lost or damaged, the TCP protocol requests its re-send.
Package Size
A typical Internet bag, 64 to 1,500 bytes, and when you download a photo of 3 MB, it breaks into about 2,000 bags!
🔬
Package X-ray
press the layer · see the real fields
Interactor
Each package is a "maternity": the data are turned by headlines at each level of the TCP/IP stack. Press the layer to see the real fields.
Canal
Ethernet frame
14 bytes
Field
Size
Meaning
MAC Address of the recipient
6 bytes
AA:BB:CC:11:22:33
MAC sender address
6 bytes
DD:EE:FF:44:55:66
Type of protocol
2 bytes
0x0800 (IPv4)
Internet
IP pack
20 bytes
Field
Size
Meaning
Version
4 bits
4 (IPv4)
Length of the title
4 bits
5 (20 bytes)
TTL (lifetime)
8 bits
64
Protocol
8 bits
6 (TCP)
sender ' s IP
4 bytes
192.168.1.10
IP recipient
4 bytes
142.250.80.46
Transport
TCP segment
20 bytes
Field
Size
Meaning
Sender port
16 bits
49152
Port of the recipient
16 bits
443 (HTTPS)
Sequence number
32 bits
108456001
Flags
8 bits
ACK, PSH
Window Size
16 bits
65535
Application
HTTP data
Up to 1460 bytes
Field
Example
Method
GET
Path
/index.html
Version
HTTP/1.1
Host
google.com
User-Agent
Mozilla/5.0
Pick a layer
Press any layer of "mather" to see its real fields. Each level adds its title as an envelope inside the envelope.
03
Protocols: language spoken by networks
TCP/IP is a set of rules by which devices understand each other.
GEF
PIF
What is protocol?
Protocol
It's a set of rules that define the format and order of the exchange of data, as a language: for two people to understand each other, they have to speak the same language and follow the grammar.
TCP/IP Stack — Four Levels
The Internet works on a protocol stack.
TCP/IP
It consists of four levels, each of which achieves its mission:
Level
What he does
Examples of protocols
Application
Application-specific work: web, mail, files
HTTP, HTTPS, FTP, SMTP, DNS
Transport
Reliable data delivery, break-in to segments
TCP (reliable), UDP (rapid)
Internet
Addressing and routeting packages
IP, ICMP, ARP
Canal
Data transmission between adjacent devices
Ethernet, Wi-Fi, PPP
OSI model
There is a more detailed model —
OSI
Open Systems Interconnection, consisting of
7 levels
It is used for training and standardization. TCP/IP brings together some levels of OSI: applied, representative and session .
Application
In chapter 5, we will examine each level of OSI in more detail.
📧
HTTP/HTTPS
Application level
The protocol for downloading web pages. HTTPS is a secure version (with encryption). You've already seen it on the UrL:
https://...
📦
TCP
Transport level
He's making sure all the bags are in the right order. If the package is lost, he's asking for a re-sent.
📍
IP
Internet level
Responsible for addresses and routeting. Each package has an IP address for the sender and the recipient.
🔌
Ethernet/Wi-Fi
Channel level
Transmits data between neighbouring devices: the router computer, a router provider.
Analogies
Imagine you're sending a letter:
Application level
- you write the text of the letter.
Transport level
- you put it in an envelope, you write a "ordered" (TCP guarantees delivery).
Internet level
- state the address of the recipient (IP address).
Canal level
The postman carries a letter to a nearby house (physical transmission).
04
DNS: Internet Telephone Book
How domain names turn into IP addresses.
GEF
PIF
Problem: People don't like numbers
Computers use IP addresses
142.250.80.46
) but it's easier for people to remember the words.
google.com
) How can we solve this problem?
Decision: DNS
DNS
Domain System is a system that translates domain names into IP addresses, like a phone book: you know a friend's name, and you find a phone in a directory.
How does DNS work?
You're entering.
google.com
In a browser.
Browser's asking.
DNS server
: "What kind

Structural map of textbooks