UDP (User Datagram Protocol) is a connectionless, unreliable transport protocol. It belongs to the Transport Layer of the OSI model. Each single UDP packet is called a UDP datagram. UDP datagrams are embedded in an IP datagram and sent across a network.
UDP is a connectionless protocol. That means, all UDP datagrams are independent datagrams. No two UDP datagrams have a relationship. The datagrams are not sequenced or numbered in any way.
UDP is also unreliable. That means, if a UDP packet gets lost or has an error, there is no way to handle it. The only error-control mechanism in place for UDP is checksum. Other than that, there is no other error-control mechanism like a TCP handshake in place. So if a packet is duplicated or gets lost, there is no way to know.
So, what’s the point of knowing about UDP if it’s so unreliable? The connectionless and unreliable characteristics give UDP datagrams the advantage of being smaller in size than when compared to TCP packets, enabling it to be very useful when transmitting small amounts of data that do not need the robustness of TCP.
UDP makes use of Queues. What are queues? Queues are data structures in which data is processed in first-in-first-out (FIFO) order, just like any other regular queue that you may encounter in day-to-day life :)
The main difference between UDP running on the client-side and the server-side is that, on the client-side, the process makes a request for a port, an incoming queue and an outgoing queue only when the process starts. An ephemeral port (non-standard port) gets assigned to it and the queues get destroyed when the process terminates. Whereas on the server-side, the creation of incoming and outgoing queues on the standard ports occurs when the server starts running and the queues are destroyed only when the server is shutdown, that is, the queues stay alive even if the processes requesting their use get terminated.
Although UDP has many uses, one thing of interest is it’s capability to multicast. UDP has inbuilt multicasting capability whereas TCP lacks it. Cool eh? :
Download the official 2buntu app for both Android and Ubuntu Touch.