The User datagram protocol is a core member of list of protocols used for networking services. It allows the users to send messages or datagrams in this case to other users without any requirement of established connection between the two users. UDP being a connection-less protocol, is a less reliable way of exchanging data between two users . Also the transmission channel or data paths are not defined.
The advantage of UDP over TCP is that, it consumes less bandwidth as compared to Transmission control protocol (TCP) as no acknowledgement is sent in case of UDP.
Features of UDP:
UDP is less complex and easier to understand. The characteristics of UDP are given below.
End-to-end. UDP can identify a specific process running on a computer.
Connectionless. UDP follows the connectionless paradigm.
E.rror detection
Unreliable. It is an unreliable transport service as there is no concept of acknowledgement
Message-oriented. Processes using UDP send and receive individual messages called segments.
Arbitrary interaction. UDP allows processes to send to and receive from as many other processes as it chooses.
Operating system independent. UDP identifies processes independently of the local operating system.
Operation:
As seen in figure above, datagrams sent at the transmitter end does not reaches the receiver end in the same sequence as they were sent, that's why UDP is called an unreliable transport service. Also, the UDP service is not bothered about the total no. of datagrams sent at transmitter end are received at receiver end or not, no acknowledgement regarding data reception is sent back to sender.
PROCESS TO PROCESS COMMUNICATION: UDP
An approach to connection-less communication is illustrated by the User Datagram Protocol (UDP) which is a layer above the Internet. The unit which is transfer in this layer is the UDP datagram sent via sender port, and the destination is the port no. of remote pc. A UDP datagram is at the TCP/IP layer moves down and is the data field of the IP layer. The UDP datagram contains the destination port number to reach the destination. Appropriate software distributes the datagrams reaching a host onto the queues of appropriate ports.
UDP provides unreliable delivery: datagrams may be lost due to electrical interference, congestion, or physical disconnection. Often processes require a communication protocol that provides reliable delivery. One such protocol built on top of IP is TCP (for Transmission Control Protocol). TCP/IP supports end-to-end stream communication: a stream is established by connecting to it and terminated by closing it. To support reliable delivery, each packet is acknowledged. Should the acknowledgement also be acknowledged? If so, what about the ack of the ack of the ack, an so on...? The answer is that the ack is not acked. Instead, if the sender does not send the ack within some transmission period, T, it retransmits the packet, and repeats the process till it gets the ack. This process is expected but not guaranteed to terminate as long as the remote machine/network is not down. After a certain number of tries, the sender gives up and closes the connection.
Retransmission can result in duplicate packets being received at the sending site. As discussed below, TCP/IP allows a packet to be sent without waiting for the acknowledgement of the previous packet. Packets are associated with sequence numbers to distinguish between normal packets and duplicates. A packet with a sequence number less than or equal to the last one received successfully is discarded as a duplicate. However, its ack is resent since the ack for the original packet may have been lost.
The system allows a sequence of packets within a sliding window to have outstanding acknowledgements. This approach increases the concurrency in the system since packets and acks can be travelling simultaneously on the system. It also reduces the number of messages in the system since an ack for a packet simply indicates the next expected sequence number, thereby implicitly acking for all messages with a lower sequence number. With each ack, the transmission window slides forward past the message acked, hence the term sliding window. TCP/IP allows the size of the sliding window to vary depending on how much buffer space the receiver has and how much congestion there is in then network. TCP/IP connections are two-way and an ack for a packet received from a machine can be piggybacked on a message sent to that machine.
UDP SEGMENT:
The above is the frame format of a UDP Header. UDP is an unreliable source of data transmission as its header (shown in fig. above) doesn't contain any sequence no. and acknowledgement number fields which helps to determine the order of sent/received segment or whether the segment's sent has been received or not. Rather, checks are made to see if the packet appears to be the same packet transmitted by evaluation of a checksum and comparison to the packets checksum. These packets are dropped if the destination calculations of the checksum differs from the packets claimed checksum.
UDP header consists of four main fields listed in the above UDP header, which are described below:
Source Port: It is a 16 bit field. This field stores the port number of the application/process of the sender's pc. At the time when connection is attempted, the client program defines itself with a temporary port no. called ephemeral port number, stored in this field.
Destination Port: It is also 16-bit field, it stores the port number of process to which sender desires to connect up with a service on a remote machine. Eg: if the client wants to access SMTP of the destination end then it will fill the destination port no. as 162.
Length: It is a 16 bit field. It consists of the length of the UDP header and the data length. It also allows the receiving station to know how many of the incoming bits are part of header bits and data bits.
UDP Checksum: Checksum is a 16 bit field. It is a error handling technique in which the length of bits is stored in the segment while sending it, purpose being, at the receiver end the receiver can use this checksum to compare with data that it is same as it was at transmission end or it is error effected.
Data: This part is the payload or the data portion of an UDP packet. The payload may be any number of protocols (often application layer.) Some of the most commonly used UDP protocols include NFS, DNS, as well as mutliple audio and video streaming protocols.
UDP being a connectionless and unreliable protocol have certain uses:
The Domian name serve (DNS) uses UDP.
Voice and video transmission uses UDP
SNMP, DHCP also uses connectionless service i.e. UDP service
Short message service which does not require reliability uses UDP, as there is no need to establish a connection and then terminate it.
Protocols with inbuilt error control and flow control also make use of UDP. Eg:- TFTP.