# Q3(c) · Reliable application over UDP

Subject: Computer Networks

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/cn/#tee/papers/paper-2024-ai-final/q3c

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/papers/paper-2024-ai-final--q3c/

Exact historical variant. Current-syllabus questions solved; excluded topics and source limitations stated.

### Q3(c). Can an application achieve reliable transfer while running over UDP? If so, how? [5 marks]

### Answer

**User Datagram Protocol (UDP)** provides connectionless, message-oriented process delivery. One send creates a datagram; message boundaries are retained. UDP has an **8-byte header**, carries ports and length, and offers checksum-based corruption detection. It does not itself guarantee delivery, ordering, duplicate suppression, retransmission, flow control or congestion control.

Swipe across the diagram to read its labels ↔

![UDP header: each row contains 32 bits](https://deep-learning-study-room.vercel.app/cn/fig/tee-udp.b14cba3c28.svg)

Diagram: UDP header: each row contains 32 bits. Labels: UDP header: each row contains 32 bits | UDP header: each row contains 32 bits | Source port · 16 | Destination port · 16 | Length · 16 | Checksum · 16 | Total 8 bytes. Length = header + UDP payload.

UDP fixed header: four 16-bit fields, eight bytes total.

| UDP field | Width | Purpose |
| --- | --- | --- |
| Source port | 16 bits | Sending endpoint; a zero value can indicate no reply port when unused |
| Destination port | 16 bits | Receiving application endpoint |
| Length | 16 bits | UDP header plus UDP payload; minimum 8 bytes |
| Checksum | 16 bits | Error detection over UDP and an IP pseudo-header; not retransmission |

## Operation and services

1. The application chooses the destination IP/port and supplies a message. UDP adds its header and passes the datagram to IP without a connection handshake.
2. The receiving UDP layer validates the length/checksum as applicable and uses the destination endpoint to deliver the datagram.
3. A corrupt or undeliverable datagram may be discarded; UDP does not recover it. Any reliability or rate-control policy must come from the application or a protocol above UDP.
4. UDP checksum zero can mean checksum omitted in IPv4. IPv6 ordinarily requires the UDP checksum; specialized exceptions are outside this syllabus.

#### Practical example

A DNS query often uses UDP because a small request/reply can avoid a transport handshake. DNS also uses TCP, so “DNS always UDP” is incorrect.

**Yaad rakho:** UDP datagram preserve; reliability automatic nahi.

**Yes, reliability can be implemented above UDP.** Add sequence numbers, acknowledgments, checksums, retransmission timers, duplicate suppression, ordering buffers and flow/congestion handling as required. If packet5 is lost, an application-level timeout retransmits5; a receiver seeing a duplicate5 acknowledges it without delivering it twice. UDP itself still supplies no delivery guarantee: the application protocol supplies these mechanisms and may eventually report failure rather than guarantee delivery across a permanent outage.
