If UDP is unreliable why is it used at transport layer

10,973

Solution 1

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.

Solution 2

... rather than Transport layer which implies reliability

There's more than one dimension within "reliability." It's interesting to note that UDP is reliable in that it provides a checksum to prevent against corruption.

Stream protocols like TCP create problems for latency-sensitive applications. For latency-sensitive apps, UDP's natural limitation (to shed traffic during congestion) is a huge boon.

why not use it(UDP) at some other layer

IP datagrams are designed to be small enough to make the next hop transit. UDP datagrams can span IP datagrams, so there's some value added there. But if TCP were a layer above UDP, it would be limited by UDP's semantics (TCP ports are bound to a connection, UDP datagrams are not).

Solution 3

The reason why UDP is used at the transport layer is because the way these layers are set up. UDP is inherently a protocol for transferring data from point A to point B, not as an application or at the hardware layer.

At the transport layer there is no assumption of reliability, but rather that UDP is a protocol for transferring data. Under the 7 layer style of networking, it falls in the interface between the network and session layers. The name Transport layer simply says what it does. Reference wikipedia for more information on the OSI model.

TLDR The reason UDP is in the transport layer is because it is a protocol for data transport, and is therefore in the transport layer. All protocols that deal with data transport fall under this category

Share:
10,973
Anon
Author by

Anon

Updated on June 07, 2022

Comments

  • Anon
    Anon almost 2 years

    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.