Lesson 62: Packets
このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
English
Small pieces, any route
- Big data is not sent in one piece. It is split into small packets.
- Each packet has a header: who sent it, where it goes, and its packet number.
- Packets can take different routes, so they may arrive out of order. The receiver puts them back in order by number.
Words for this lesson
| Word | Meaning |
|---|---|
| packet | a small piece of the data, with a header |
| header | information about the packet, such as its number |
| payload | the data the packet carries |
| router | a device that chooses the route for each packet |
English
HELLO WORLD in packets of 4
| Header | Payload |
|---|---|
| 1/3 | HELL |
| 2/3 | O WO |
| 3/3 | RLD |
English
In the exam
- 0478/11/M/J/23 Q2(c): (i) two things in a packet header. Mark scheme: the destination address, the packet number, the sender's address. (ii) How packet switching works. Mark scheme: the data is split into packets; each packet may take a different route, chosen by a router; packets may arrive out of order; when the last packet arrives they are put back in order; a missing packet is requested again.
難易度 3/5 · 200 コイン + 今日初回達成時の小ボーナス
On the internet, data is split into packets. Each packet has a header with its number and the total number of packets. Type a message. The program has worked out total, the number of 4-character packets. Print each packet on its own line as number/total:data, for example 1/3:HELL.
実行ボタンをクリックして出力を確認してください。
難易度 4/5 · 280 コイン + 今日初回達成時の小ボーナス
Now be the receiver. Packets can take different routes, so they arrive out of order. The program reads the number n, the total and the data from each packet. Store the data in parts[n] and count the packets. When the last one has arrived, print Message: and the parts in order, from 1 to total.
実行ボタンをクリックして出力を確認してください。