Application-layer protocols · 应用层协议
| English | 中文 | Pinyin · 拼音 |
|---|---|---|
| application layer/ˌæplɪˈkeɪʃn ˈleɪə/ | 应用层 | yìng yòng céng |
| peer-to-peer/pɪə tə pɪə/ | 对等网络 | duì děng wǎng luò |
| HTTP/ˌeɪtʃ tiː tiː ˈpiː/ | 超文本传输协议 | chāo wén běn chuán shū xié yì |
| HTTPS/ˌeɪtʃ tiː tiː piː ˈes/ | 安全超文本传输协议 | ān quán chāo wén běn chuán shū xié yì |
| TLS/ˌtiː el ˈes/ | 传输层安全 | chuán shū céng ān quán |
| FTP/ˌef tiː ˈpiː/ | 文件传输协议 | wén jiàn chuán shū xié yì |
| SMTP/ˌes em tiː ˈpiː/ | 简单邮件传输协议 | jiǎn dān yóu jiàn chuán shū xié yì |
| POP3/pɒp ˈθriː/ | 邮局协议3 | yóu jú xié yì 3 |
| IMAP/ˈaɪmæp/ | 互联网邮件访问协议 | hù lián wǎng yóu jiàn fǎng wèn xié yì |
| BitTorrent/bɪt ˈtɒrənt/ | 比特流 | bǐ tè liú |
Why your inbox looks the same on every device
- Open your email on a laptop, then on a phone. The same messages are there, and the ones you have read are marked read on both.
- That is not obvious. For twenty years the normal thing was for a mail program to download everything and delete it from the server, so whichever device fetched the mail first was the only one that had it.
- Both behaviours are still in use, and choosing between them is choosing between two protocols with the same job and opposite designs.
- This lesson is the application layer 应用层 protocols the syllabus names: web, file transfer, the three mail protocols, and peer-to-peer.
你的收件箱为什么在每台设备上都一样
- 在笔记本上打开邮件,再在手机上打开。同样的消息都在,读过的在两边都标着已读。
- 这并不理所当然。有二十年时间,通常的做法是邮件程序把一切下载下来并从服务器删除,所以哪台设备先取邮件,哪台就是唯一有它的设备。
- 两种行为今天都还在用,而在它们之间选择,就是在两个工作相同、设计相反的协议之间选择。
- 这一课讲大纲点名的应用层(application layer)协议:网页、文件传输、三个邮件协议,以及对等网络。
The web: HTTP and HTTPS
- HTTP 超文本传输协议 is how a browser fetches web pages and their resources from a server. It runs over TCP, normally on port 80.
- HTTPS 安全超文本传输协议 is HTTP carried inside TLS 传输层安全, so the traffic is encrypted, on port 443.
- What HTTPS adds: an eavesdropper on the path sees only ciphertext, the server proves its identity with a certificate, and any tampering is detected. Use it whenever the data is private, which today means always.
网页:HTTP 和 HTTPS
- HTTP(超文本传输协议)是浏览器从服务器取网页及其资源的方式。它跑在 TCP 上,通常用 80 端口。
- HTTPS(安全超文本传输协议)是装在 TLS(传输层安全)里的 HTTP,所以流量是加密的,用 443 端口。
- HTTPS 带来什么:路径上的窃听者只看到密文,服务器用证书证明自己的身份,任何篡改都会被发现。数据私密时就用它——今天这意味着永远用它。
Network route lab · 网络路由实验
Follow data from a device through network hardware and protocols. · 跟踪设备通过网络硬件和协议的数据传输路径。
HTTPS is: · HTTPS是:
HTTPS runs HTTP over TLS encryption (port 443), protecting the data in transit. · HTTPS在TLS加密之上运行HTTP(端口443),保护传输中的数据。
What does HTTPS add over plain HTTP? Select all · 所有 that apply. · HTTPS相比普通HTTP增加了什么?选择所有适用项。
TLS supplies confidentiality, authentication and integrity. Compression is a separate feature of HTTP itself. · TLS提供机密性、认证和完整性。压缩是HTTP自身的独立功能。
File transfer: FTP
- FTP 文件传输协议 transfers files between a client and a server: upload, download, list, rename and delete.
- It is designed for whole files, where HTTP is designed for documents and resources a browser renders.
- Plain FTP sends its credentials in the clear, which is why secured variants replaced it for anything sensitive.
文件传输:FTP
- FTP(文件传输协议)在客户端和服务器之间传输文件:上传、下载、列目录、重命名和删除。
- 它是为整个文件设计的,而 HTTP 是为浏览器要渲染的文档和资源设计的。
- 普通 FTP 以明文发送凭据,这就是敏感场合它被安全变体取代的原因。
Email: SMTP, POP3 and IMAP
- SMTP 简单邮件传输协议 sends mail: from the client to its outgoing server, and from server to server across the internet. It is the push half of email.
- POP3 邮局协议3 downloads mail to one device and usually deletes it from the server. The mail lives on that device.
- IMAP 互联网邮件访问协议 leaves mail on the server and synchronises the state, folders, read flags, deletions, across every device. The mail lives on the server.
Every one of these protocols ends up inside frames like this one
电子邮件:SMTP、POP3 和 IMAP
- SMTP(简单邮件传输协议)发送邮件:从客户端到它的发件服务器,以及跨互联网从服务器到服务器。它是邮件的"推"的那一半。
- POP3(邮局协议3)把邮件下载到一台设备,通常从服务器删除。邮件住在那台设备上。
- IMAP(互联网邮件访问协议)把邮件留在服务器上,并在每台设备之间同步状态——文件夹、已读标记、删除。邮件住在服务器上。

这些协议最终都装进这样的帧里
Which protocol is used to SEND email? · 哪个协议用于发送电子邮件?
SMTP sends mail; POP3 and IMAP are used to receive/read it. · SMTP发送邮件;POP3和IMAP用于接收/阅读。
IMAP leaves mail on the server and syncs it across all your devices, while POP3 typically downloads the mail and deletes it from the server. · IMAP将邮件留在服务器上并在所有设备间同步,而POP3通常下载邮件并从服务器删除。
That is why IMAP shows the same inbox on your phone and laptop, whereas POP3 ties mail to one device. · 这就是为什么IMAP在手机和笔记本电脑上显示相同的收件箱,而POP3将邮件绑定到单个设备。
Worked example: choose a mail protocol
- A user reads mail on a phone, a laptop and a desktop, and wants the same inbox on all three. Which receiving protocol, and why?
- IMAP: the messages stay on the server and the client synchronises with it, so a message read or filed on one device shows as read or filed on the others.
- A second user has one old laptop, a tiny mailbox quota and often no internet. POP3: the mail is downloaded to the laptop and removed from the server, which frees the quota and lets it be read offline.
- The deciding facts are how many devices and where the mail must live. SMTP is not an answer to either: it sends.
例题:选择邮件协议
- 一位用户在手机、笔记本和台式机上读邮件,希望三台设备上是同一个收件箱。用哪个接收协议,为什么?
- IMAP:消息留在服务器上,客户端与它同步,所以在一台设备上读过或归档的消息,在其他设备上也显示为已读或已归档。
- 另一位用户只有一台旧笔记本、很小的邮箱配额,而且经常没有网络。 POP3:邮件被下载到笔记本并从服务器移除,这释放了配额,也让邮件可以离线阅读。
- 决定性的事实是有几台设备和邮件必须住在哪里。SMTP 不是这两个问题的答案:它是发送。
A user reads mail on three devices and wants read messages marked read everywhere. Which protocol receives the mail? · 用户在三个设备上阅读邮件并希望已读标记在所有设备上生效。应使用哪种协议接收邮件?
IMAP leaves the mail on the server and synchronises state across devices. POP3 downloads to one device and usually deletes; SMTP sends. · IMAP将邮件留在服务器上并在设备间同步状态。POP3下载到单个设备通常删除;SMTP用于发送。
POP3 downloads mail to one device and usually ____ it from the server. · POP3将邮件下载到单个设备并通常____它从服务器。
That frees the mailbox quota and suits a single device used offline, but the mail then exists only on that device. · 这释放了邮箱配额,适合离线使用的单设备,但之后邮件仅存在于该设备上。
Peer-to-peer: BitTorrent
- BitTorrent 比特流 is a peer-to-peer 对等网络 protocol: there is no single server holding the file for everyone.
- The file is split into pieces. A tracker helps peers find each other, and each peer then downloads pieces from many other peers in parallel while uploading the pieces it already has.
- The effect: the more popular a file, the more peers there are to serve it, so the load spreads instead of concentrating. A single server would need bandwidth proportional to the number of downloaders.
Every downloader is also an uploader
对等网络:BitTorrent
- BitTorrent(比特流)是一个对等网络(peer-to-peer)协议:没有单一服务器为所有人保存文件。
- 文件被切成小块。一个 tracker 帮助各节点找到彼此,然后每个节点从许多其他节点并行下载小块,同时上传自己已有的小块。
- 效果是:文件越流行,提供它的节点就越多,于是负载被分散而不是集中。单一服务器所需的带宽与下载者数量成正比。

每个下载者同时也是上传者
BitTorrent reduces load on any single server because it: · BitTorrent减轻任何单台服务器的负载因为它:
As a peer-to-peer protocol, each peer shares pieces, so no single server carries the whole load. · 作为点对点协议,每个对等节点共享片段,因此没有单台服务器承载全部负载。
Worked example: why peer-to-peer for a large release
- A free operating system is released as a 4 GB file and a million people download it on the first day. Explain why BitTorrent suits this better than a single web server.
- With HTTP, one server must send 4 GB a million times, so its bandwidth and cost scale with the number of downloaders, and it becomes the bottleneck and a single point of failure.
- With BitTorrent, the file is split into pieces and each peer uploads the pieces it has already received, so capacity grows with the number of downloaders instead of being consumed by them.
- The answer names the load, says where it goes, and says what happens as demand rises.
例题:大型发布为什么用对等网络
- 一个免费操作系统以 4 GB 的文件发布,第一天有一百万人下载。解释为什么 BitTorrent 比单一 Web 服务器更适合。
- 用 HTTP,一台服务器必须把 4 GB 发送一百万次,所以它的带宽和成本与下载者数量成正比,它会成为瓶颈和单点故障。
- 用 BitTorrent,文件被切块,每个节点上传自己已经收到的块,所以容量随下载者数量增长,而不是被他们消耗。
- 答案要说出负载、说出它去了哪里,以及需求上升时会发生什么。
With BitTorrent, the more people download a file, the more capacity there is to serve it. · 使用BitTorrent时,下载该文件的人越多,可用的服务容量就越大。
Every peer uploads the pieces it already has, so capacity grows with demand. A single server's bandwidth is consumed by demand instead. · 每个对等节点上传其已有的片段,因此容量随需求增长。单台服务器的带宽被需求消耗而非支撑需求。
The protocols at a glance
| Protocol | Job |
|---|---|
| HTTP | fetch web pages, port 80 over TCP |
| HTTPS | HTTP inside TLS, encrypted, port 443 |
| FTP | transfer whole files to and from a server |
| SMTP | send mail, client to server and server to server |
| POP3 | download mail to one device, usually deleting it from the server |
| IMAP | leave mail on the server, synchronised across devices |
| BitTorrent | peer-to-peer sharing of file pieces |
协议一览
| 协议 | 工作 |
|---|---|
| HTTP | 取网页,TCP 上的 80 端口 |
| HTTPS | 装在 TLS 里的 HTTP,加密,443 端口 |
| FTP | 与服务器之间传输整个文件 |
| SMTP | 发送邮件,客户端到服务器、服务器到服务器 |
| POP3 | 把邮件下载到一台设备,通常从服务器删除 |
| IMAP | 邮件留在服务器上,跨设备同步 |
| BitTorrent | 对等网络的文件块共享 |
Match each protocol to its use. · 将每个协议与其用途匹配。
HTTP = web, FTP = files, SMTP = sending email (POP3/IMAP receive it). · HTTP = 网页,FTP = 文件,SMTP = 发送邮件(POP3/IMAP接收)。
Marks that slip away
- SMTP sends; POP3 and IMAP receive. A question asking how mail is sent has exactly one answer.
- The IMAP versus POP3 difference is where the mail lives: server and synchronised, or downloaded and deleted.
- HTTPS is not a different protocol from HTTP; it is HTTP over TLS, and TLS is what adds the encryption.
- BitTorrent spreads load because every peer uploads. "It is faster" without that reason earns nothing.
容易丢掉的分
- **SMTP 发送;POP3 和 IMAP 接收。**问邮件怎样发送的题恰好只有一个答案。
- IMAP 与 POP3 的区别是邮件住在哪里:在服务器上并同步,还是下载后删除。
- HTTPS 不是与 HTTP 不同的协议;它是 TLS 上的 HTTP,加密是 TLS 带来的。
- BitTorrent 分散负载是因为每个节点都上传。没有这个理由,单说"它更快"不得分。
You've got it
- HTTP fetches web pages over TCP; HTTPS is the same protocol inside TLS, encrypted and authenticated; FTP moves whole files
- SMTP sends mail; POP3 downloads and usually deletes it; IMAP leaves it on the server and synchronises every device
- choose a mail protocol from how many devices there are and where the mail must live
- BitTorrent is peer-to-peer: pieces from many peers in parallel, every downloader also uploading, so capacity grows with demand
你掌握了
- HTTP 在 TCP 上取网页;HTTPS 是装在 TLS 里的同一个协议,加密并可验证身份;FTP 搬运整个文件
- SMTP 发送邮件;POP3 下载并通常删除;IMAP 留在服务器上并同步每台设备
- 从有几台设备、邮件必须住在哪里来选择邮件协议
- BitTorrent 是对等网络:从许多节点并行取块,每个下载者同时上传,所以容量随需求增长