Computer Science Foundations / Networks
Networks
All 5 lessons, in order.
The unit at a glance
- Agree on a message format
Two friends pass notes across a room through other people's hands.
- Split a message into numbered pieces
A long freight train blocks a line for a whole day.
- Reassemble pieces arriving out of order
Printed pages that say Page 2 of 11 can be put back in order however the pile was dropped. Packets on the internet may arrive in order, out of order, or not at all. They can take different paths: routing is the process of finding a path from sender to receiver, and on the internet it is usually decided as the packets travel, not fixed in advance. In the card protocol, the receiver lays out N empty slots, puts each usable card into the slot of its number when that slot is empty (a card for a filled slot is a duplicate, set aside as a later lesson shows), and reads the data of slots 1 to N in order once every slot is filled.
- Use acknowledgments in a paper protocol
A teacher who gets no answer says a name again.
- Explain a duplicate request
A reply can be lost on the way, as a request can.
Rules (5)
- Agree on a message format
A protocol is an agreed set of rules. In this unit's card protocol every data card holds, in order, To, From, Piece (a number of a total) and Data (from 1 to 4 characters); a card that breaks the format is not used.
- Split a message into numbered pieces
To send a message with the card protocol, cut it into pieces of 4 characters from the left, the last piece holding the 1 to 4 characters left over, and number the pieces from 1 to N, where N is the length divided by 4 and rounded up. Every card carries To, From, its number of N and its data.
- Reassemble pieces arriving out of order
The receiver places each usable card in the slot of its piece number when that slot is empty, whatever the order of arrival, and reads the data of slots 1 to N in order once all N slots are filled; an empty slot means no usable card for that piece has arrived yet.
- Use acknowledgments in a paper protocol
In the card protocol, which carries one message at a time, the receiver sends
ACK nfor each usable piece n, and the sender keeps a list of pieces not yet acknowledged, removes a piece when its acknowledgment arrives, and sends a piece again when its time runs out. The sender knows every piece has arrived when every piece has been sent and its list is empty; the receiver may hold them all sooner. - Explain a duplicate request
When a lost acknowledgment leaves a piece on the sender's list as its wait runs out, the sender sends it again; if that copy arrives, the receiver gets a duplicate. In the card protocol the receiver recognizes a duplicate because the slot of its number is already filled, keeps the copy it has, and sends the acknowledgment again.
Recipes (5)
- Agree on a message format
- List the fields the protocol requires, in order.
- For each data card, check that every field is there.
- Check that the fields are in the agreed order: To, From, Piece, Data.
- Check the Piece field: a number from 1 up to the total, written as a number of the total.
- Check the Data field: at least 1 and no more than 4 characters.
- Mark the card as following the protocol only when every check passes.
- Split a message into numbered pieces
- Count the characters of the message, spaces and punctuation included.
- Count the full groups of 4 characters, and add one more card if any characters are left over: that is N, the number of pieces.
- Cut the message into pieces of 4 characters from the left; the last piece takes what is left.
- Write one card for each piece, with To, From, its number of N and its data.
- Check that joining the data of cards 1 to N in order gives back the message.
- Reassemble pieces arriving out of order
- Check each arriving card against the protocol. Read the total on the first usable data card and lay out that many empty slots.
- Put each usable card into the slot of its piece number if that slot is empty; put a card that fails the check aside.
- After each card, list the slots still empty.
- When no slot is empty, read the data of the slots from 1 to N.
- If a slot stays empty, the message is not complete; do not guess its data.
- Use acknowledgments in a paper protocol
- Write each piece on the sender's list of pieces sent and not yet acknowledged, then send it and start its wait.
- On the receiver's side, check each card against the protocol, place it in its slot as in the last lesson (a slot already filled keeps its first card, as the next lesson shows), and send
ACK nfor each usable card. - For each acknowledgment that reaches the sender, cross its piece off the list.
- When a piece's wait runs out and the piece is still on the list, send it again and start its wait again.
- Stop when every piece has been sent and the sender's list is empty.
- Explain a duplicate request
- When a card arrives, check it against the protocol; a card that breaks it is put aside without an acknowledgment.
- For a usable card, look at the slot of its number.
- If the slot is empty, place the card there and send
ACK n. - If the slot is filled, the card is a duplicate: leave the slot as it is and send
ACK nagain. - On the sender's side, cross the piece off at the first
ACK nand ignore any later one.
Traps (5)
- Agree on a message format
A card that leaves out the total,
Piece 2instead ofPiece 2 of 3, breaks the protocol, and the receiver cannot learn the total from that card. Keep both numbers.A format that only one side knows is not a protocol. If Ana changes the data length to 5 characters without telling Kai, Kai's checks reject her cards.
- Split a message into numbered pieces
Leaving spaces and punctuation out of the count can give the wrong number of pieces:
MEET-AT-NOON.counted without its period has 12 characters and gets 3 cards instead of 4. Every character is part of the message.Numbering from 0 on some cards and from 1 on others breaks the agreement. The card protocol numbers from 1 to N.
- Reassemble pieces arriving out of order
Joining pieces in the order they arrive gives
NOONMEET-AT-for the arrivals 3, 1, 2. Place by number.Reading the message while a slot is empty gives a message with a hole in it. Wait for every slot; the next lesson shows how the sender sends a missing piece again.
- Use acknowledgments in a paper protocol
Waiting forever for an answer stalls the whole message. Without a timeout, a lost piece is never sent again.
Acknowledging a card before checking it defeats the purpose. An acknowledgment says the piece arrived and is usable; a card that fails the format checks is not acknowledged. The checks cannot catch every change: NOON turned into SOON on the way still passes them.
- Explain a duplicate request
Treating a duplicate as a new piece breaks the message. Appending the second
-AT-would giveMEET-AT-NOON-AT-. Place by number, and a filled slot stays as it is.Ignoring a duplicate without acknowledging it again can leave the sender waiting: if no acknowledgment reaches it, its time runs out again and it keeps resending. Answer every usable copy.
Lesson 1 of 5
Agree on a message format
Open this lessonLeans on 1Comes back in 0
Leans on
Comes back in
No lesson links recorded.
1 In plain words
Two friends pass notes across a room through other people's hands. Everyone involved agrees first on how a note is written, so that each person who picks one up knows who it is for.
A protocol is an agreed set of rules for how a system behaves. The internet runs on protocols that anyone may use, which lets new devices join it.
This unit uses an invented paper protocol, the card protocol. Every data card carries four fields in this order (acknowledgment cards, in a later lesson, have a short form of their own): To, the receiver's name; From, the sender's name; Piece, written as a number of a total, such as 2 of 3; and Data, from 1 to 4 characters of the message. A card that lacks a field, or holds no data or more than 4 characters of it, breaks the protocol. The fields are this unit's own choice; real packets also carry their origin and destination.
Remember one sentence: a protocol is the rules both sides agreed on before the first message. To look it up, see essential knowledge CSN-1.B.3 in the AP Computer Science Principles Course and Exam Description.
2 Picture it
A table of the four fields of one card. To is Kai, who receives it. From is Ana, who sent it. Piece is 2 of 3, its place in the message. Data is -AT-, the content. The Piece row is marked.
3 Why
A receiver can act only on what the format promises. The To field lets a card be passed on toward the right person; the Piece field lets the pieces be put back in order and tells the receiver how many to expect. The AP course description says the same of internet packets: they carry data used for routing them and for putting the data back together.
Even a protocol that does not promise delivery has a formal structure: the Field Guide notes that UDP packets still carry their destination, their origin and their size.
Both sides must hold the same rules. A sender who writes the piece number last, or a receiver who expects data of 5 characters, cannot rely on the other side reading the card as it was meant.
4 The rule
A protocol is an agreed set of rules.
In this unit's card protocol every data card holds, in order, To, From, Piece (a number of a total) and Data (from 1 to 4 characters); a card that breaks the format is not used.
5 How
- List the fields the protocol requires, in order.
- For each data card, check that every field is there.
- Check that the fields are in the agreed order: To, From, Piece, Data.
- Check the Piece field: a number from 1 up to the total, written as a number of the total.
- Check the Data field: at least 1 and no more than 4 characters.
- Mark the card as following the protocol only when every check passes.
6 Trace
| Card | Problem | Follows the protocol? | Explanation |
|---|---|---|---|
| To Kai, From Ana, Piece 1 of 3, Data MEET | none | yes | All four fields, a valid piece number and 4 characters of data. |
| To Kai, From Ana, Data -AT- | no Piece field | no | Without a piece number the receiver cannot place it. |
| To Kai, From Ana, Piece 3 of 3, Data NOON. | 5 characters of data | no | The data field holds at most 4 characters. |
7 The trap
A card that leaves out the total, Piece 2 instead of Piece 2 of 3, breaks the protocol, and the receiver cannot learn the total from that card. Keep both numbers.
A format that only one side knows is not a protocol. If Ana changes the data length to 5 characters without telling Kai, Kai's checks reject her cards.
Quick checks
Quick check 1 of 2
A card reads To Kai, From Ana, Piece 2, Data NOON. Which rule of the card protocol does it break, and what can Kai not tell from it?
Show the steps and the answer
Its Piece field has no total, so Kai cannot tell how many pieces the message has.
Why: The protocol writes a piece as a number of a total, such as 2 of 3. Without the total, Kai cannot know when every piece has arrived.
Quick check 2 of 2
In one sentence, what is a protocol?
Show the steps and the answer
An agreed set of rules that specifies how a system behaves.
Why: The AP course description defines a protocol that way; the card protocol is one, agreed by sender and receiver.
Source: College Board, AP Computer Science Principles Course and Exam Description
Sources
- AP Computer Science Principles Course and Exam Description. College Board. All rights reserved. Read 2 Dec 2026.
- Computer Science Field Guide: Network Communication Protocols, 16.3 Transport layer protocols - TCP, UDP. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 2 Dec 2026.
Lesson 2 of 5
Split a message into numbered pieces
Open this lessonLeans on 0Comes back in 0
Leans on
No lesson links recorded.
Comes back in
No lesson links recorded.
1 In plain words
A long freight train blocks a line for a whole day. Split into short trains, it shares the line with others, and the short trains can even take different routes.
The internet sends data the same way: a message travels as a stream of chunks, each wrapped in a packet with data used for routing and reassembly, as the AP course description puts it. The Field Guide gives the reason: a large message sent whole can hold up other traffic on its route.
In the card protocol, split the message into pieces of 4 characters, from the left, and number them from 1. The last piece holds whatever is left, from 1 to 4 characters. Every card carries the same total. The size of 4 is this protocol's choice; what matters is that each chunk travels with what is needed to put it back.
Remember one sentence: cut, number, and write the total on every piece. To look it up, see essential knowledge CSN-1.C.1 and CSN-1.C.2 in the AP Computer Science Principles Course and Exam Description.
2 Picture it
A table of the message MEET-AT-NOON split into three pieces of 4 characters. Piece 1 of 3 holds MEET, piece 2 of 3 holds -AT- and piece 3 of 3 holds NOON. The row for piece 2 is marked.
3 Why
The number of pieces is the message length divided by 4, rounded up. MEET-AT-NOON has 12 characters, so it makes exactly 3 pieces; MEET-AT-NOON. has 13, so it makes 4, and the fourth holds only the period.
Each card is complete on its own. The To and From fields go on every card, because each card may travel separately, by its own path.
Small pieces are what let different messages share a busy route.
4 The rule
To send a message with the card protocol, cut it into pieces of 4 characters from the left, the last piece holding the 1 to 4 characters left over, and number the pieces from 1 to N, where N is the length divided by 4 and rounded up.
Every card carries To, From, its number of N and its data.
5 How
- Count the characters of the message, spaces and punctuation included.
- Count the full groups of 4 characters, and add one more card if any characters are left over: that is N, the number of pieces.
- Cut the message into pieces of 4 characters from the left; the last piece takes what is left.
- Write one card for each piece, with To, From, its number of N and its data.
- Check that joining the data of cards 1 to N in order gives back the message.
6 Trace
| Step | Piece and data | Characters left | Explanation |
|---|---|---|---|
| count | 13 characters, so N = 4 | 13 | 13 divided by 4 is 3.25, rounded up to 4. |
| card 1 | 1 of 4: MEET | 9 | The first 4 characters. Every card also carries To Kai and From Ana. |
| card 2 | 2 of 4: -AT- | 5 | The next 4. |
| card 3 | 3 of 4: NOON | 1 | The next 4. |
| card 4 | 4 of 4: . | 0 | The last piece holds the one character left. |
7 The trap
Leaving spaces and punctuation out of the count can give the wrong number of pieces: MEET-AT-NOON. counted without its period has 12 characters and gets 3 cards instead of 4. Every character is part of the message.
Numbering from 0 on some cards and from 1 on others breaks the agreement. The card protocol numbers from 1 to N.
Quick checks
Quick check 1 of 2
The card protocol of this unit puts at most 4 characters on a card. A message has 10 characters. How many cards does it need, and how many characters does the last card hold?
Show the steps and the answer
It needs 3 cards, and the last card holds 2 characters.
Why: By the protocol's 4-character rule, 10 divided by 4 is 2.5, rounded up to 3. The first two cards hold 4 characters each, which leaves 2.
Source: College Board, AP Computer Science Principles Course and Exam Description
Quick check 2 of 2
Why does the internet send a large file as many small packets instead of one big one?
Show the steps and the answer
A message sent whole would hold up other traffic; small packets share the routes, and each can travel separately.
Why: The Field Guide compares a whole message to a long freight train that blocks a line; split up, the pieces share it and can take different routes.
Sources
- Computer Science Field Guide: Network Communication Protocols, 16.3 Transport layer protocols - TCP, UDP. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 2 Dec 2026.
- AP Computer Science Principles Course and Exam Description. College Board. All rights reserved. Read 2 Dec 2026.
Lesson 3 of 5
Reassemble pieces arriving out of order
Open this lessonLeans on 0Comes back in 0
Leans on
No lesson links recorded.
Comes back in
No lesson links recorded.
1 In plain words
Printed pages that say Page 2 of 11 can be put back in order however the pile was dropped.
Packets on the internet may arrive in order, out of order, or not at all. They can take different paths: routing is the process of finding a path from sender to receiver, and on the internet it is usually decided as the packets travel, not fixed in advance.
In the card protocol, the receiver lays out N empty slots, puts each usable card into the slot of its number when that slot is empty (a card for a filled slot is a duplicate, set aside as a later lesson shows), and reads the data of slots 1 to N in order once every slot is filled. A slot still empty means no usable card for that piece has arrived yet.
Remember one sentence: place each piece by its number, not by when it came. To look it up, see essential knowledge CSN-1.C.2 and CSN-1.C.3 in the AP Computer Science Principles Course and Exam Description.
2 Picture it
A table of three cards that arrive out of order. The first to arrive is piece 3 of 3, which fills slot 3. The second is piece 1 of 3, so slots 1 and 3 are filled. The third is piece 2 of 3, and all three slots are filled. The last row is marked.
3 Why
The order of arrival depends on the paths the pieces took, and one path can be faster or shorter than another. In this unit's runs every usable card keeps the number the sender wrote, so the slots put the data back in the order the sender cut it.
The total on each card tells the receiver how many slots to lay out, so a gap shows. With pieces 1 and 3 of 3 in their slots, slot 2 is empty, and the message is not ready.
Joining the pieces in arrival order can mix up the message when they arrive out of order. The Field Guide describes TCP, the Transmission Control Protocol used on the internet, putting a sequence number on each packet for this reason; without one, a delayed piece can turn HELLO into HELOL.
4 The rule
The receiver places each usable card in the slot of its piece number when that slot is empty, whatever the order of arrival, and reads the data of slots 1 to N in order once all N slots are filled; an empty slot means no usable card for that piece has arrived yet.
5 How
- Check each arriving card against the protocol. Read the total on the first usable data card and lay out that many empty slots.
- Put each usable card into the slot of its piece number if that slot is empty; put a card that fails the check aside.
- After each card, list the slots still empty.
- When no slot is empty, read the data of the slots from 1 to N.
- If a slot stays empty, the message is not complete; do not guess its data.
6 Trace
| Card arrives | Slots 1, 2, 3 | Empty slots | Explanation |
|---|---|---|---|
| 3 of 3: NOON | _, _, NOON | 1, 2 | The total says three slots; NOON goes in slot 3. |
| 1 of 3: MEET | MEET, _, NOON | 2 | MEET goes in slot 1. |
| 2 of 3: -AT- | MEET, -AT-, NOON | none | Every slot is filled: the message is MEET-AT-NOON. |
7 The trap
Joining pieces in the order they arrive gives NOONMEET-AT- for the arrivals 3, 1, 2. Place by number.
Reading the message while a slot is empty gives a message with a hole in it. Wait for every slot; the next lesson shows how the sender sends a missing piece again.
Quick checks
Quick check 1 of 2
Cards of a 3-piece message arrive in the order 2 of 3 (-AT-), 3 of 3 (NOON), 1 of 3 (MEET). What message does the receiver read, and after which arrival is it complete?
Show the steps and the answer
It reads MEET-AT-NOON, complete after the third arrival.
Why: Each card goes into the slot of its number. Slot 1 stays empty until the last card, piece 1, arrives.
Quick check 2 of 2
A receiver holds pieces 1, 2 and 4 of a 4-piece message. What does it know, and what can it not do yet?
Show the steps and the answer
It knows piece 3 is missing, and it cannot read the whole message yet.
Why: The total says four slots. Slot 3 is empty, so a piece has not arrived, and packets can be lost on the way.
Source: College Board, AP Computer Science Principles Course and Exam Description
Sources
- Computer Science Field Guide: Network Communication Protocols, 16.3 Transport layer protocols - TCP, UDP. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 2 Dec 2026.
- AP Computer Science Principles Course and Exam Description. College Board. All rights reserved. Read 2 Dec 2026.
Lesson 4 of 5
Use acknowledgments in a paper protocol
Open this lessonLeans on 0Comes back in 0
Leans on
No lesson links recorded.
Comes back in
No lesson links recorded.
1 In plain words
A teacher who gets no answer says a name again. TCP does the same with a packet that got no answer.
In the Field Guide's description, TCP uses acknowledgments: messages sent back to tell the sender that a packet arrived and is usable. If no answer comes back within a set time, a timeout, the sender sends the packet again. The card protocol uses only acknowledgments, so a piece with no ACK in time is sent again. Its ACK n for each piece is a simplified rule of this unit's own.
The card protocol adds one rule for each side. The receiver answers every usable card with an acknowledgment card, ACK n, for its piece number. The sender keeps a list of the pieces not yet acknowledged and sends each of them again when its time runs out. Two people send one message at a time, so every ACK card belongs to the message being sent.
Remember one sentence: no acknowledgment in time means send it again. To look it up, see section 16.3.1 of the Computer Science Field Guide's chapter on network communication protocols.
2 Picture it
A table of Ana sending three pieces to Kai. Ana sends pieces 1, 2 and 3, and her list of pieces not yet acknowledged holds all three. Piece 2 is lost; ACK 1 and ACK 3 come back, leaving 2 on her list while Kai holds 1 and 3. Her time runs out and she sends piece 2 again. ACK 2 comes back, her list is empty and Kai holds all three. The timeout row is marked.
3 Why
The sender cannot see the far end. In the card protocol an acknowledgment is the only news that a piece arrived usable, so a piece without one is treated as lost.
Acknowledgments travel in the opposite direction from the data, which gives the receiver a way to report back. The sender's list shrinks with the first acknowledgment of each piece; a later ACK for a piece already crossed off changes nothing. Once every piece has been sent, the list is empty only when every piece is known to have arrived.
The timeout is the last defense: it covers a lost piece and a lost acknowledgment alike, because in both cases the sender hears nothing.
4 The rule
In the card protocol, which carries one message at a time, the receiver sends ACK n for each usable piece n, and the sender keeps a list of pieces not yet acknowledged, removes a piece when its acknowledgment arrives, and sends a piece again when its time runs out.
The sender knows every piece has arrived when every piece has been sent and its list is empty; the receiver may hold them all sooner.
5 How
- Write each piece on the sender's list of pieces sent and not yet acknowledged, then send it and start its wait.
- On the receiver's side, check each card against the protocol, place it in its slot as in the last lesson (a slot already filled keeps its first card, as the next lesson shows), and send
ACK nfor each usable card. - For each acknowledgment that reaches the sender, cross its piece off the list.
- When a piece's wait runs out and the piece is still on the list, send it again and start its wait again.
- Stop when every piece has been sent and the sender's list is empty.
6 Trace
| Event | Ana's list | Kai's slots | Explanation |
|---|---|---|---|
| Ana sends pieces 1, 2, 3 | 1, 2, 3 | _, _, _ | Every piece starts on the list. |
| piece 2 is lost | 1, 2, 3 | _, _, _ | Nothing tells Ana yet. |
| pieces 1 and 3 arrive; ACK 1 and ACK 3 reach Ana | 2 | MEET, _, NOON | Kai sends ACK 1 and ACK 3, and Ana crosses off 1 and 3 as they arrive. |
| timeout for piece 2: Ana sends it again | 2 | MEET, _, NOON | Piece 2 is still on the list when its time runs out. |
| piece 2 arrives; ACK 2 reaches Ana | none | MEET, -AT-, NOON | The list is empty and the message is complete. |
7 The trap
Waiting forever for an answer stalls the whole message. Without a timeout, a lost piece is never sent again.
Acknowledging a card before checking it defeats the purpose. An acknowledgment says the piece arrived and is usable; a card that fails the format checks is not acknowledged. The checks cannot catch every change: NOON turned into SOON on the way still passes them.
Quick checks
Quick check 1 of 2
Ana sends pieces 1 to 4. She receives ACK 1, ACK 2 and ACK 4. Which piece does she send again when its time runs out?
Show the steps and the answer
Piece 3.
Why: Pieces 1, 2 and 4 are crossed off her list. Only piece 3 is still waiting for an acknowledgment.
Quick check 2 of 2
Ana sends a 3-piece message and piece 2 is lost once, as in the trace. How many data cards does she send in all, and how many acknowledgment cards does Kai send?
Show the steps and the answer
Ana sends 4 data cards, and Kai sends 3 acknowledgment cards.
Why: Pieces 1, 2 and 3 plus the second copy of piece 2 make 4. Kai acknowledges each of the 3 pieces once, when it arrives.
Sources
- Computer Science Field Guide: Network Communication Protocols, 16.3 Transport layer protocols - TCP, UDP. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 2 Dec 2026.
Lesson 5 of 5
Explain a duplicate request
Open this lessonLeans on 0Comes back in 0
Leans on
No lesson links recorded.
Comes back in
No lesson links recorded.
1 In plain words
A reply can be lost on the way, as a request can. When a reply is lost and no other reply reaches the sender before its wait runs out, the sender repeats a message the receiver already has.
If an acknowledgment is lost and no other acknowledgment for that piece arrives, the sender's wait runs out and it sends the piece again, and if that copy arrives, the receiver gets a duplicate. TCP recognizes duplicates and ignores them.
The card protocol adds the receiver's last rule: a usable card whose slot is already filled is a duplicate. The receiver keeps the copy it has, puts the new one aside, and sends ACK n again, so the sender can cross the piece off.
Remember one sentence: same number, same piece, so keep one and acknowledge again. To look it up, see section 16.3.1 of the Computer Science Field Guide's chapter on network communication protocols.
2 Picture it
A table of piece 2 arriving twice. Piece 2 arrives and fills slot 2 with -AT-, and Kai sends ACK 2. ACK 2 is lost. Ana's time runs out and piece 2 arrives again; slot 2 keeps the -AT- it holds, and Kai sends ACK 2 again. The last row is marked.
3 Why
From the sender's side, a lost piece and a lost acknowledgment look the same: no answer. So the timeout sends the piece again in both cases, and some resends are duplicates.
The piece number shows a duplicate: the slot of that number is already filled. Keeping the first copy and ignoring the second leaves the message unchanged. Acknowledging the duplicate again matters when the sender is still waiting for an answer to that piece, as it is when the first acknowledgment was lost.
Resending is one way a network tolerates faults. Another is redundancy, such as more than one path between two devices, so that a failed path does not cut them off.
4 The rule
When a lost acknowledgment leaves a piece on the sender's list as its wait runs out, the sender sends it again; if that copy arrives, the receiver gets a duplicate.
In the card protocol the receiver recognizes a duplicate because the slot of its number is already filled, keeps the copy it has, and sends the acknowledgment again.
5 How
- When a card arrives, check it against the protocol; a card that breaks it is put aside without an acknowledgment.
- For a usable card, look at the slot of its number.
- If the slot is empty, place the card there and send
ACK n. - If the slot is filled, the card is a duplicate: leave the slot as it is and send
ACK nagain. - On the sender's side, cross the piece off at the first
ACK nand ignore any later one.
6 Trace
| Event | Ana's list | Kai's slots | Explanation |
|---|---|---|---|
| Ana sends 1, 2, 3; all arrive | 1, 2, 3 | MEET, -AT-, NOON | Kai fills all three slots and sends ACK 1, ACK 2, ACK 3. |
| ACK 2 is lost; ACK 1 and ACK 3 reach Ana | 2 | MEET, -AT-, NOON | Ana crosses off 1 and 3 only. |
| timeout: Ana sends piece 2 again | 2 | MEET, -AT-, NOON | Ana cannot tell that piece 2 arrived. |
| the duplicate arrives; the new ACK 2 reaches Ana | none | MEET, -AT-, NOON | Slot 2 is filled, so the copy is ignored. The new ACK 2 empties Ana's list. |
7 The trap
Treating a duplicate as a new piece breaks the message. Appending the second -AT- would give MEET-AT-NOON-AT-. Place by number, and a filled slot stays as it is.
Ignoring a duplicate without acknowledging it again can leave the sender waiting: if no acknowledgment reaches it, its time runs out again and it keeps resending. Answer every usable copy.
Quick checks
Quick check 1 of 2
Kai's slots for a 3-piece message hold MEET, -AT- and NOON. A card To Kai, From Ana, Piece 3 of 3, Data NOON arrives. What should Kai do?
Show the steps and the answer
Keep the NOON already in slot 3, put the new card aside as a duplicate, and send ACK 3 again.
Why: The card follows the protocol, but slot 3 is already filled, so under the card protocol it is a duplicate: the same piece has arrived twice.
Quick check 2 of 2
Two offices are joined by a single cable. Why does adding a second, separate path between them make the connection more fault-tolerant?
Show the steps and the answer
If one path fails, data can still travel by the other, so the offices stay connected.
Why: Redundancy, extra components such as a second path, lets a system keep working when one component fails.
Source: College Board, AP Computer Science Principles Course and Exam Description
Sources
- Computer Science Field Guide: Network Communication Protocols, 16.3 Transport layer protocols - TCP, UDP. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 2 Dec 2026.
- AP Computer Science Principles Course and Exam Description. College Board. All rights reserved. Read 2 Dec 2026.