Senior
Is it possible to guarantee data delivery over UDP?
sobes.tech AI
Answer from AI
UDP is a connectionless protocol without delivery guarantees, so by itself it does not ensure reliable data delivery. To achieve delivery guarantees over UDP, additional mechanisms need to be implemented at the application level, such as:
- Acknowledgments (ACK) from the receiver.
- Retransmission of packets when no acknowledgment is received.
- Packet numbering to detect losses and duplicates.
- Timeouts and delivery order control.
Example: protocols like QUIC or RTP use UDP but add such mechanisms for reliability. In Go, you can implement this yourself using net.UDPConn and acknowledgment logic.