UDP Packet Flow
UDP (User Datagram Protocol) is a connectionless transport protocol that sends discrete packets — called datagrams — with no setup handshake, no delivery guarantee, and no ordering enforcement.
UDP (User Datagram Protocol) is a connectionless transport protocol that sends discrete packets — called datagrams — with no setup handshake, no delivery guarantee, and no ordering enforcement.
Where TCP prioritizes reliability, UDP prioritizes speed. The trade-off is appropriate for latency-sensitive applications where occasional packet loss is preferable to retransmission delays: live video/audio streaming, online gaming, DNS queries, VoIP, and network monitoring.
No Connection Setup: UDP requires no handshake. The application hands a datagram to the socket, and the kernel immediately encapsulates it in a UDP header (source port, destination port, length, checksum) and passes it to the IP layer. Total overhead is 8 bytes per datagram.
IP Encapsulation: The IP layer adds its own header (source IP, destination IP, TTL, protocol=17 for UDP) and routes the packet toward the destination. Each datagram is routed independently — successive datagrams between the same endpoints may take different paths.
No Acknowledgment: The sender gets no confirmation of delivery. If a datagram is lost due to congestion, a routing failure, or buffer overflow, it simply disappears. The application is responsible for handling retransmission if needed.
No Ordering: Datagrams may arrive out of order. A datagram sent later may arrive before one sent earlier. Again, the application layer must reorder if required.
Checksum: UDP includes an optional (IPv4) or mandatory (IPv6) checksum covering the header and data. This detects corruption but does not trigger retransmission.
These properties make UDP the foundation for modern protocols like QUIC, which builds its own reliability, ordering, and congestion control on top of UDP to gain the deployment flexibility of UDP (traverses NAT, no kernel state) while achieving TCP-like guarantees at the application layer.