The User Datagram Protocol gives application programs direct access to a datagram delivery service, like the delivery service that IP provides. This allows applications to exchange messages over the network with a minimum of protocol overhead.UDP is an unreliable, connectionless datagram protocol. (As noted before, "unreliable" merely means that there are no techniques in the protocol for verifying that the data reached the other end of the network correctly.) Within your computer, UDP will deliver data correctly. UDP relies on the upper layer protocol for both error correction and reliable service. The protocol is transaction oriented and delivery and duplicate protection are not guaranteed. The major uses of this protocol are DNS and TFTP.
UDP has a small header and for all intents and purposes it adds Port
addressing to the IP header. The IP header routes datagrams to the correct
host on the network. UDP routes the datagram to the correct application.
UDP Header
|
- Source Port :- The Source Port is a 16 bit number that Indicates the upper level service (that the source is transmitting). UDP allows port numbers to be in the range from 0 to 65,535. The Source Port is optional, and if not used, a field of 0s is inserted.Clients will have a unique port number assigned to them by the server. Typically, the number will be above 8,000.
- Destination Port :-The Destination Port is a 16 bit number: it indicates the upper level service that the source wishes to communicate with at the destination.
- Length :- The Length field is 16 bits long, indicates the length of the UDP datagram, and has a maximum value of 65, 535 bytes (and a minimum value of 8 bytes).
- Checksum :-The Checksum field is 16 bits long: it calculates a checksum that is based on the UDP header, the Data field, and what is called the UDP Pseudo header. The UDP Pseudo header consists of the Source IP Address, Destination IP Address, Zero, IP Protocol field and UDP Length. For UDP, the IP Protocol field value is 17.
- Data :- The data field contains the IP header and data. The Data field may be padded with zero octets at the end (if necessary) to make a multiple of two octets.
- the creation of new receive ports,
- receive operations on the receive ports that return the data octets and an indication of source port and source address,
- an operation that allows a datagram to be sent, specifying the data, source and destination ports and addresses to be sent.
Why do applications programmers choose UDP as a data transport service?
There are a number of good reasons. If the amount of data being transmitted
is small, the overhead of creating connections and ensuring reliable delivery
may be greater than the work of
retransmitting the entire data set. In this case, UDP is the most efficient
choice for a Transport Layer protocol. Applications that fit a "query-response"
model are also excellent candidates for using UDP. The response can be
used as a positive acknowledgment to the query. If a response isn't received
within a certain time period, the application just sends another query.
Still other applications
provide their own techniques for reliable data delivery, and don't
require that service from the transport layer protocol. Imposing
another layer of acknowledgment on any of these types of applications
is inefficient.
for details refer RFC 768