Back to tree

🤝 传输控制协议:可靠送达的握手🤝 TCP: The Reliable Handshake

上一片里,DNS 帮小电脑查到了门牌号。可包裹送到张三手里,丢了算谁的?小电脑寄生日祝福,得保证一件不少。 Last leaf, DNS found the house number for the little computer. But who pays if a parcel goes missing? Sending birthday wishes to Sam, it must deliver every piece.

第 1 步:开寄先握三下手Step 1: Shake hands three times first

小电脑抱着箱子就寄吗?先敲门。Does the little computer just ship the box? It knocks first.

小电脑和张三三次握手确认都在家再开寄
小电脑喊:在家吗(SYN)?张三回:在家,寄吧(SYN-ACK)!小电脑说:好,开寄(ACK)!三句确认都在家,路才通。这就是三次握手。 The little computer calls: home (SYN)? Sam answers: home, send it (SYN-ACK)! It replies: OK, sending (ACK)! Three lines confirm both sides are ready. That is the three-way handshake.

路上小包走散了,有的还丢了,怎么办?Packets scatter on the road, and some get lost — now what?

第 2 步:拆包编号,缺了补寄Step 2: Number the pieces, resend what's lost

大箱拆成编号小包乱序到达按序拼回缺号补寄
大箱拆成 1 到 5 号小包,到时顺序全乱。张三按编号拼回:1、2、3 上架了,4 号空着。小电脑喊:缺 4 号,请补寄!丢包重传,一件不少。 The big box is split into packets 1 to 5, arriving all jumbled. Sam shelves them by number: 1, 2, 3 are up, slot 4 is empty. The little computer calls: #4 is missing, please resend! Lost packets are resent, so nothing is lost.

件件都补寄,会不会太慢?Resending every piece — isn't that slow?

第 3 步:稳车还是纸飞机Step 3: Steady van or paper plane

TCP稳车保网页文件邮件一件不少UDP纸飞机保视频游戏够快
TCP 开稳车:网页、文件、邮件一件不能少。路堵了它会减速让行,这就是流量控制。UDP 坐纸飞机:视频通话、游戏只求快。下一片,我们看谁来指路。 TCP drives a steady van: web pages, files and mail must all arrive. When roads jam it slows down — that is flow control. UDP rides a paper plane: video calls and games just want speed. Next leaf, we meet the guide at the crossing.

🎮 当一回收件人(60 秒)🎮 Be the receiver (60 seconds)

你是张三:先握手,再按 1、2、3 点小包上架。缺了哪号,就发回执请补寄,共拼好 4 条消息。You are Sam: shake hands first, then shelve packets 1, 2, 3 in order. If a number is missing, send a receipt to ask for it. Rebuild 4 messages.

一句话记住它:TCP 是可靠快递:先握手,拆包编号送,缺了补寄,不多不少按序到。 Remember it in one line: TCP is reliable delivery — shake hands, send numbered pieces, resend gaps, all in order.
先三次握手确认都在家,再开寄Shake hands three times to confirm, then send 按编号组装,缺号发回执要求补寄Reassemble by number; ask for resends with receipts 网页文件邮件用 TCP,视频游戏追快用 UDPFiles and mail use TCP; video and games chase speed with UDP
内容参考 OpenStax 等公开教材,多来源核对 · AI 生成、人工审核 · 发现错误欢迎指正,帮这片叶子长得更好。 Based on OpenStax and other open textbooks, cross-checked across sources · AI-generated, human-reviewed · Spotted a mistake? Tell us — help this leaf grow.