Lesson 67: Wait for the ACK
이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
No reply? Send it again
- In a positive ARQ (automatic repeat query), the receiver sends an acknowledgement (ACK) for each packet that arrives without errors.
- The sender starts a timer when it sends a packet. No ACK before the timeout: it sends the packet again.
millis()is the timer: the time since the board started, in ms.
Words for this lesson
| Word | Meaning |
|---|---|
| acknowledgement | a message back: "I got it" |
| timeout | the time limit for the ACK |
| resend | send the same packet again |
English
The first program, step by step
| Time (ms) | What happens |
|---|---|
| 0 | send packet 1, timer starts |
| 400 | ACK: packet 1 OK, send packet 2 |
| 1400 | no ACK for 1000 ms: resend packet 2 |
| 1800 | ACK: packet 2 OK, send packet 3 |
| 2200 | ACK: packet 3 OK, all sent |
English
In the exam
- 0478/11/M/J/24 Q9(b)(i): describe how a parity check and a positive ARQ find errors. Mark scheme points for the ARQ: the packet is sent and a timer is started; if the data is correct, an acknowledgement is sent; the sender then sends the next packet and restarts the timer; if the data has an error, no acknowledgement is sent; if no acknowledgement arrives before the timeout, the packet is resent.
난이도 4/5 · 280코인 + 오늘 첫 완료 시 작은 보너스 추가
The Arduino sends 3 packets. You are the receiver: type ACK when a packet arrives. The sender keeps the time it sent the packet in sentAt. Add the 타임아웃: if no ACK has come after more than 1000 ms, print Timeout: resend packet and the number, and send the packet again with sendPacket().
출력을 보려면 '실행'을 클릭하세요.
난이도 4/5 · 280코인 + 오늘 첫 완료 시 작은 보너스 추가
If the link is broken, the sender should not try for ever. Count the tries in tries. After a timeout on the third try, print Link down and stop. Otherwise add 1 to tries, print for example Timeout: resend packet 2 (try 2) and send again. tries goes back to 1 when an ACK arrives.
출력을 보려면 '실행'을 클릭하세요.