Not every application requires guaranteed delivery, and these applications typically
use UDP for transport services. Unlike TCP, UDP sends only the data it has
received from the application, and makes no pretense towards guaranteed delivery
or flow control or anything else. As such, UDP is much like IP, but is the protocol
that applications use to communicate with each other, rather than using IP
directly.
UDP is much like a postcard. If you were travelling around a foreign country, you
might send postcards to friends and family from the different cities that you visit,
informing them of recent events. You wouldn’t worry about the postcards getting
delivered quickly, or even if they got lost entirely, since you’ll probably send more
postcards from the next town anyway. You wouldn’t necessarily want the postcards
to get lost, but at the same time you wouldn’t rely on the postcards for any
urgent business (like “send money to the embassy”). For anything important, you’d
use the telephone (TCP) to ensure that your message arrived intact and was processed
correctly.
You may wonder why a UDP protocol exists, when it would seem that IP could
serve the same function. The reason is simple: IP doesn’t do anything but get datagrams
from one host to another. IP doesn’t provide any application interfaces or
management services. UDP does provide these services, and it provides a consistent
environment for developers to use when writing low-overhead network applications.
UDP also provides application multiplexing services through the use of
port numbers, allowing many application protocols to be used on a single host.
Trying to do this with IP would require either a lot more transport protocols, or an
application multiplexing layer within IP directly, neither of which would be very
efficient.
Another benefit of UDP is that it offers a message-centric delivery model, allowing
chunks of data to be sent as single IP datagrams (instead of being streamed over
virtual circuits like they would with TCP). For example, a UDP-based application
protocol can write a four-kilobyte block of data to UDP, and that block will be
handed to IP directly. IP will then create an IP datagram that contains the entire
four kilobytes, and send this data as a series of IP packets to the destination system
(according to the rules defined for the network medium in use). Once all of
the data arrives, the IP datagram is reassembled and the entire four-kilobyte UDP
message will be handed to UDP for processing.
0 comments:
Post a Comment