UDP, along with TCP, also referred to as TCP/IP are at the top of IP. However, they have several differences.
Unlike TCP which uses handshakes, UDP uses the minimum number of mechanisms by providing checksums for data integrity, and port numbers for taking care of other functionality and datagram destinations.
How it works
UDP’s main purpose is to save time between communication signals and it, therefore, uses IP to transmit datagrams from one device to another. It gathers data into UDP packages and adds some information into the header. The data injected in the packet include destination ports, source, checksum, and the packet length.
Once the resulting packets are encapsulated into IP packets, they are dispatched to their destination based on the packet information. Unlike TCP which facilitates feedback, UDP does not send back signals to show that the package destination was reached, instead, It loops the process, or stops sending.
- Supports connectionless service
- Sends packets in bulk
- Mainly used for streaming services and other services such as DNS and NFS
- Lack of error-control mechanism
- No acknowledgment after sending of receiving a package
- Only process-to-process addressing and checksum is integrated into the IP
- Lack of a flow control mechanism
- Fast communication than TCP
As stated earlier, its communication mechanism makes it perfect for use in applications such as Domain Name System (DNS), SNMP, Dynamic host configuration Protocol (DHCP) and Routing Information Protocol (RIP). Streaming services also adopt UDP since it generally suits video and voice traffic. This is because there are many instances of packet losses in this communication chain hence degrading of quality when using other protocols such as TCP.
UDP vs TCP
|Faster than TCP||Slower than TCP|
|Does not acknowledge segments||Segment acknowledgment is a must|
|Has no reliable error-checking mechanisms||Has comprehensive error checking mechanisms|
|Header size is 8 bytes||Has a header size of 20-80 bytes|
|Not reliable as it has a lot of packet loss||It is reliable and packets are guaranteed to get to the destination|
|Data sequencing is supported||Data sequencing is not supported|