Datagram Sockets

UDP is a second, widely used transport protocol that builds on IP connections. UDP stands for User Datagram Protocol and differs from TCP in several basic areas:

□ UDP is packet-oriented. No explicit connection setup is required before data are sent.

□ Packets can be lost during transmission. There is no guarantee that data will actually reach their destination.

□ Packets are not necessarily received in the same order in which they were sent.

UDP is commonly used for video conferencing, audio streaming, and similar services. Here it doesn't matter if a few packets go missing — all that would be noticed would be brief dropouts in multimedia sequences. However, like IP, UDP guarantees that the contents of packets are unchanged when they arrive at their destinations.

An IP address and port number can be used by a TCP and a UDP process at the same time. In multiplexing, the kernel ensures that only packets of the correct transport protocol are forwarded to the appropriate process.

Comparing TCP and UDP is like comparing the postal service with the telephone network. TCP corresponds to a telephone call. The calling party must set up a connection (which must be accepted by the person called) before information can be passed. During the call, all information sent is received in the same order in which it was sent.

UDP can be likened to the postal service. Packets (or letters in this analogy) can be sent to recipients without contacting them in advance for permission to do so. There is no guarantee that letters will be delivered (although both the postal service and the network will do their best). Similarly, there is no guarantee that letters will be sent or received in a particular sequence.

Those interested in further examples of the use of UDP sockets are referred to the many textbooks on network and system programming.

Continue reading here: The Layer Model of Network Implementation

Was this article helpful?

0 0