1752802 Members
5714 Online
108789 Solutions
New Discussion юеВ

Re: Why is UDP needed?

 
ericfjchen
Regular Advisor

Re: Why is UDP needed?

The key point is "Why can't a user program directly access IP?"...even if I fully understand OSI, I can't answer the question. Pls kindly share your opinion.
rick jones
Honored Contributor

Re: Why is UDP needed?

To answer why we need UDP and don't just use IP directly, you need to go back and refresh yourself on how IP "demultiplexes" the incoming datagrams between TCP, UDP and the like and the implications that would have for many applications on a given host/IP address wanting to communicate at the same time.
there is no rest for the wicked yet the virtuous have no pillows
Elmar P. Kolkman
Honored Contributor

Re: Why is UDP needed?

If you communicate directly to IP, you would have one stream of data between two servers, because you only can define both IP addresses (from and to address) for the communciation, nothing more, nothing less.
By using a protocol on top of that, like UDP, you can use a seperate identifier, the serviceport. In TCP, you even use 2 serviceports, one on the server, and one on the client. This results in a lot of possible connections between two servers.

Also, for instance inetd uses these ports to determine which program needs to be started for which port.

By talking directly to IP, which is possible, you would have to do this all by yourself.
Every problem has at least one solution. Only some solutions are harder to find.
rick jones
Honored Contributor

Re: Why is UDP needed?

Elmar is partially correct - basically, the "demux" abilities are limited in IP - IP uses the "protocol" field of the IP header to determine the ULP (Upper Layer Protocol) to which a datagram should be given. The protocol field in the IP header is IIRC only 8 bits, so there can be only so many concurrent "protocols"

Both TCP and UDP expand on this with their source and destination port numbers - the values used for "demux" by TCP and UDP.
there is no rest for the wicked yet the virtuous have no pillows
Olivier Decorse
Respected Contributor

Re: Why is UDP needed?

Eric,
UDP is needed for the transmission of data in which delivery of the data is more important than accuracy. UDP reduces overhead because it does not add flow control, error control, or sequence delivery unlike connectionoriented services. UDP can be used in real-time applications, where TCP cannot !
They say "install windows 2k, xp or better", so i install unix !
iqra
New Member

Re: Why is UDP needed?

When using UDP, packets are just sent to the recipient. The sender wonтАЩt wait to make sure the recipient received the packet тАФ it will just continue sending the next packets. If youтАЩre the recipient and you miss some UDP packets, too bad тАФ you canтАЩt ask for those packets again. ThereтАЩs no guarantee youтАЩre getting all the packets and thereтАЩs no way to ask for a packet again if you miss it, but losing all this overhead means the computers can communicate more quickly.

UDP is used when speed is desirable and error correction isnтАЩt necessary. For example, UDP is frequently used for live broadcasts and online games.

For example, letтАЩs say youтАЩre watching a live video stream. Live streams are often broadcast using UDP instead of TCP. The server just sends a constant stream of UDP packets to computers watching. If you lose your connection for a few seconds, the video will freeze for a moment and then jump to the current bit of the broadcast, skipping the bits you missed. If you experience minor packet-loss, the video or audio may be distorted for a moment as the video continues to play without the missing data.