Protocols and the TCP/IP model
| English | Chinese | Pinyin |
|---|---|---|
| protocol | 协议 | xié yì |
| TCP | 传输控制协议 | chuán shū kòng zhì xié yì |
| UDP | 用户数据报协议 | yòng hù shù jù bào xié yì |
| modularity | 模块化 | mó kuài huà |
| link layer | 链路层 | liàn lù céng |
| abstraction | 抽象 | chōu xiàng |
| application layer | 应用层 | yìng yòng céng |
| transport layer | 传输层 | chuán shū céng |
| port numbers | 端口号 | duān kǒu hào |
| internet layer | 网络层 | wǎng luò céng |
| packets | 数据包 | shù jù bāo |
| IP address | IP地址 | IP dì zhǐ |
| routers | 路由器 | lù yóu qì |
| MAC addresses | MAC地址 | MAC dì zhǐ |
| connection-oriented | 面向连接 | miàn xiàng lián jiē |
| connectionless | 无连接 | wú lián jiē |
| layering | 分层 | fēn céng |
The two-word message that started the internet
- On 29 October 1969 a student at UCLA typed the word LOGIN to a machine at Stanford, one letter at a time, with a colleague on the telephone confirming each one. After L and O the system crashed.
- The problem was never the wire. It was that two machines built by different companies had no agreed rules about what a byte meant, when to speak, or what to do when something was lost.
- Everything since has been the writing down of those rules. A protocol 协议 is that agreement, and the internet is a stack of them.
- This lesson is why protocols exist, why they are layered 分层, the four TCP/IP layers, and the difference between TCP and UDP.
What a protocol defines
- A protocol is a set of rules for how devices communicate. Both ends must follow the same rules, or one side's signals are meaningless to the other.
- It defines the format of the data, where the addresses sit and where the payload starts; the order of messages, who speaks first and when to acknowledge; the meaning of each message; the timing, timeouts and retransmissions; and what to do on an error.
- Without one, communication fails completely, the way two people with no shared language fail.

Rules agreed in advance, by both ends
A network protocol is:
A protocol defines the format, order, meaning, timing and error handling of messages — both ends must agree.
What does a protocol define? Select all that apply.
Format, order, meaning, timing and error handling. The cable's speed is a property of the hardware, not of the agreement.
Why the protocols are layered
- Networking is too complex for one set of rules, so it is split into layers, each with one focused job, each talking only to the layer above and the layer below. The implementation is a stack.
- Modularity 模块化: one layer can be replaced without touching the others, so swapping Ethernet for Wi-Fi changes nothing above the link layer.
- Standardisation: equipment from different vendors interoperates because each layer's interface is agreed. Abstraction 抽象: a programmer writing a web app ignores everything the lower layers handle.

Four layers, each with one job
A benefit of splitting networking into layers is:
Each layer has one job and a clear interface, so (e.g.) Ethernet can be swapped for Wi-Fi without touching higher layers.
The four TCP/IP layers
| Layer | Purpose | Examples |
|---|---|---|
| application layer 应用层 | services for user programs, and the protocols they speak | HTTP, FTP, SMTP, IMAP |
| transport layer 传输层 | end-to-end delivery between processes, identified by port numbers 端口号 | TCP, UDP |
| internet layer 网络层 | carrying packets 数据包 between hosts by IP address IP地址, forwarded by routers 路由器 | IP |
| link layer 链路层 | sending bits over one physical link, framing with MAC addresses MAC地址 | Ethernet, Wi-Fi |
- The internet layer does not guarantee delivery. That is the transport layer's job, and only if TCP is used.
Tap the four layers of the TCP/IP model
Explore each layer. Data travels DOWN the stack as it's sent (each layer adds its header) and back UP as it's received — and any layer can be swapped without touching the others.
Match each TCP/IP layer to its job.
Application = user protocols; Transport = TCP/UDP delivery; Internet = IP routing; Link = bits on the medium.
The internet layer (IP) guarantees that every packet arrives.
IP forwards packets and does not guarantee delivery. Reliability is added above it, by TCP, and UDP deliberately does without it.
Worked example: a message crossing the internet
- Describe what happens at each layer when a browser requests a page from a server.
- Application: the browser builds an HTTP request for the page.
- Transport: TCP splits it into segments, adds the port numbers, and will acknowledge and retransmit anything lost.
- Internet: IP adds the source and destination IP addresses to each packet, and routers forward it hop by hop across networks.
- Link: each hop puts the packet in a frame with MAC addresses and sends the bits over the cable or radio. At the server the layers are unwrapped in reverse.
Put the TCP/IP layers in order, from the user's program down to the wire.
Each layer wraps the one above; at the far end they are unwrapped in reverse order.
TCP and UDP
- TCP 传输控制协议 is connection-oriented 面向连接: it sets up a connection first, ensures all data arrives and in order, retransmits lost packets and controls flow. Reliable, at the cost of overhead and delay. Used by HTTP, HTTPS, SMTP and FTP.
- UDP 用户数据报协议 is connectionless 无连接: it sends and forgets, with no acknowledgements, no ordering and no retransmission. Low overhead, no guarantees.
- UDP is used for live streaming, DNS and online gaming, where speed beats reliability: a retransmitted video frame would arrive after the moment it was needed, so dropping it is better than waiting.

Guaranteed and slower, or fast and unguaranteed
How does TCP differ from UDP?
TCP sets up a connection and ensures reliable, ordered delivery (with overhead); UDP is fire-and-forget.
TCP is connection-oriented and guarantees ordered, complete delivery (with overhead), while UDP is fire-and-forget — faster but with no delivery guarantee.
That's why UDP suits live streaming, gaming and DNS, but TCP is used for files, email and secure web pages where every byte must arrive.
Live video streaming uses ____ because speed matters more than retransmitting lost packets.
A resent frame would arrive after the moment it was needed, so dropping it beats waiting. TCP's guarantees are worth their cost for a payment page.
Worked example: choose the transport protocol
- A company streams a live sports match and also sells tickets through a web page. Which transport protocol for each, and why?
- The live stream: UDP. A lost frame is worthless by the time it could be resent, so speed and low delay matter more than completeness, and the viewer would rather lose a frame than watch the picture stall.
- The ticket page: TCP. Every byte of the payment and booking must arrive, correct and in order, so the acknowledgements and retransmissions are worth their overhead.
- Name the protocol, then give the property of the data that decides it.
Marks that slip away
- A protocol is a set of rules, not a program or a cable. Name at least two of the things it defines.
- The benefit of layering is modularity, standardisation and abstraction, not "it is faster".
- IP does not guarantee delivery; TCP does. Do not credit the internet layer with reliability.
- UDP is not "worse". It is chosen where speed beats reliability, and the answer must say which kind of data that is.
You've got it
- a protocol is agreed rules for format, order, meaning, timing and error handling, followed by both ends
- protocols form a stack of layers, giving modularity, standardisation and abstraction
- TCP/IP layers: application (HTTP, SMTP), transport (TCP, UDP, port numbers), internet (IP addresses, routers), link (Ethernet, Wi-Fi, MAC addresses)
- TCP is connection-oriented, ordered and reliable; UDP is connectionless with no guarantees, for streaming, DNS and gaming