If UDP is unreliable why is it used at transport layer

Anon picture Anon · Aug 14, 2012 · Viewed 10.8k times · Source

Sorry for what is a stupid question.

Function of transport layer is reliable delivery of messages. UDP is inherently unreliable, why do we use it at Transport layer then?

Thanks

EDIT: Just to clarify, I have read the Wiki and other sources. My question is

UDP is Unreliable (I know why and the advantages and where it is used etc.) , why not use it(UDP) at some other layer, rather than Transport layer which implies reliability.

Answer

Michael Graczyk picture Michael Graczyk · Aug 14, 2012

Sometimes it is more important that the data be sent quickly and without pauses than that the stream be reliable. DNS uses UDP because the transaction between a DNS server and client consists of only one packet each way. If the packet is lost, it will be re transmitted at the request of the client.

Similarly, streaming video often uses UDP as a transport protocol because the occasional loss of a packet is acceptable. It is preferable that the image quality suffer as a result of lost packets, rather than the video stream suffer jitter or pauses (lag) as a result of TCP synchronization.

Games also often use UDP, sacrificing engine accuracy for improved speed/user experience.

These and more examples can be found in the relevant portions of the wikipedia article.

EDIT

UDP is used at the transport layer because it is a transport layer protocol. It provides "provides end-to-end communication services for applications" (RFC1122).

Reliability services are optional for transport layer protocols.