If UDP is unreliable why is it used at transport layer
Asked Answered
M

4

6

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.

Mungovan answered 14/8, 2012 at 2:8 Comment(0)
P
14

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.

Phenoxide answered 14/8, 2012 at 2:12 Comment(8)
I edited my question, would you be kind enough to check it again? Thanks.Mungovan
+1,for the "Reliability services are optional for transport layer protocols." but as Brian pointed out, reliability can be used as something to counter data corruption, which is taken care by UDP checksum.Mungovan
@Mungovan Technically, that is not true. The term "reliable" is used in computer networking to describe protocols which are able to notify the sender than data has been delivered. UDP is not reliable, and checksums are not a factor in network reliability.Phenoxide
thanks. I guess this means your answer is better. But Wiki says "Reliability: Packets may be lost during transport due to network congestion and errors. By means of an error detection code, such as a checksum, the transport protocol may check that the data is not corrupted, and verify correct receipt by sending an ACK or NACK message to the sender. Automatic repeat request schemes may be used to retransmit lost or corrupted data." So does it imply checksum is part of reliability?Mungovan
Reliability services are optional for transport layer protocols, I did not know that. Is that mentioned in the RFC?Mungovan
@Mungovan A checksum can be used as a part of the reliability mechanism, but their presence or absence does not make a protocol reliable. UDP does not use the checksum to verify that a datagram was received, nor does it verify in any way precisely because it is unreliable. If you implemented another protocol on top of UDP that did use the checksum to verify that a datagram had been received, and also trigger re-transmission on failure, then you might have a reliable protocol. UDP would not be the part of the stack introducing reliability; that would be your addition on top of UDP.Phenoxide
let us continue this discussion in chatMungovan
It is discussed in the OSI Model spec, ISO/IEC 7498-1:1998. Section 7.4.4.1.2 specifies connectionless-mode transport layer protocols (like UDP). Notice the lack of "end to end error recovery", which is present in the optional functions of connection-mode transport layer protocols in section 7.4.4.1.1.Phenoxide
R
3

... 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).

Riding answered 14/8, 2012 at 2:29 Comment(2)
Great answer, just what I was looking for. +1Mungovan
Just for future reference, checksums in UDP are not a part of reliability. Reliability in network protocols is the property that the protocol can confirm or guarantee to the sender that a transmission was received.Phenoxide
P
2

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

Pike answered 14/8, 2012 at 2:21 Comment(0)
E
0

Transport layer classes

Class 0 - Simple class
Class 1 - Basic error recovery class
Class 2 - Multiplexing class
Class 3 - Error Recovery and multiplexing class
Class 4 - Error detection and recovery class
Extricate answered 14/7, 2021 at 7:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.