Transport (TCP/UDP)
Diperkenalkan
Kosa kata
| English | Makna |
|---|---|
| UDP/ˌjuː diː ˈpiː/ | A transport protocol providing datagrams and ports without guaranteeing delivery or order. |
| TCP/ˌtiː siː ˈpiː/ | A transport protocol providing a reliable ordered byte stream with flow and congestion control. |
| three-way handshake | The SYN, SYN-ACK and ACK exchange normally used to establish a TCP connection. |
English
Two postcards and a courier
- UDP: 8-byte header — ports, length, checksum — a postcard. TCP: sequence numbers, acknowledgements, retransmission, flow and congestion control — a courier with a ledger.
- The three-way handshake (SYN, SYN-ACK, ACK) opens a connection; FINs close it.

{exercise:uni-cs0904-two}
Latihan
The UDP header carries —
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
8 bytes: two ports, a length, a checksum - the postcard.
English
The ledger
- SYN consumes sequence 0; the server SYN-ACK carries its own 0. Client sends 100 bytes: seq 1, server ACKs 101. Sends 50: seq 101, ACK 151.
- A 30-byte segment at seq 151 is lost: the cumulative ACK stays 151 until the timeout retransmits — then ACK 181. One ACK number summarises the whole receive state.
{exercise:uni-cs0904-ledger}
Latihan
After SYN (seq 0), 100 bytes then 50 sent, the server ACKs —
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Cumulative: 1 + 100 + 50 = 151 - the next byte expected.
English
Choosing UDP
- DNS fits in one UDP datagram: a request is one packet, and if it is lost the client re-asks. Video calls tolerate loss but not delay: a retransmitted frame due in 30 ms arrives too late to matter.
- TCP guarantees order and delivery, never latency; flow control protects the receiver's buffer, congestion control protects the network — two different windows.
{exercise:uni-cs0904-choice}
Latihan
A live video call prefers —
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Retransmitted frames arrive too late: tolerate loss, avoid delay.