Vous êtes sur la page 1sur 5

User Datagram Protocol or UDP is part of the Internet Protocol suite, using which, programs

running on different computers on a network can send short messages known as Datagrams to
one another. UDP can be used in networks where TCP is traditionally implemented, but unlike
TCP, it does not guarantee reliability or the correct sequencing of data. Datagrams may go
missing without notice, or arrive in a different order from the one in which they were sent. The
protocol was formulated by David P. Reed in 1980 and officially defined in RFC 768.

UDP makes use of a simple communication model without implicit transmission checks for
guaranteeing reliability, sequencing, or datagram integrity. Though these factors might seem to
suggest that UDP is not a useful protocol, it still finds wide usage in particular areas where speed,
more than reliability, is of utmost importance. UDP considers that error checks and corrections
should be carried out in the communicating application, and not at the network layer.
However, if error checks and corrections are needed at the network layer, the application can
make use of Transmission Control Protocol (TCP) or Stream Control Transmission Protocol
(SCTP), which are specifically formulated for this reason. Since UDP does not have the
overhead of checking whether the data has reached the destination every time it is sent, it makes
the protocol that much faster and more efficient. UDP is often used for time-sensitive applications
where missing data is preferred to late-arriving data.

UDP is a stateless protocol which is useful for servers engaged in answering short queries from a
large number of clients. While TCP is mainly used for communication between a server and a
single client, UDP is used for packet broadcast or multicasting whereby the data is sent to all
the clients in the network. Frequent network applications that use UDP include: Trivial File
Transfer Protocol (TFTP) , Voice over IP (VoIP), IPTV, Domain Name System (DNS), etc.

Since UDP lacks any kind of mechanism to control or avoid network congestion, other forms of
network-based control mechanisms need to be implemented to ensure smooth flow of traffic in a
UDP network. One of the solutions being designed to tackle this problem is DCCP or Datagram
Congestion Control Protocol which is aimed at monitoring and controlling traffic congestion in a
UDP network.

A typical IP network consists of five layers:

• The Physical Layer consisting of the actual channel for data flow like coaxial, twisted pair or fiber
optic cables
• The Data Link Layer implementing Wi-Fi, ISDN, GPRS etc
• The Network / Internet Layer
• Transport Layer implementing TCP, UDP etc
• Application Layer running DNS, FTP, HTTP, POP3, SMTP, Telnet etc
As shown above, UDP belongs to the fourth layer. Although the entire amount of UDP traffic in a
network is a small fraction of the whole, a number of key application in the fifth layer like DNS and
SNMP or simple network management protocol use UDP.

UDP Packet
The UDP header comprises of only four fields. The use of two of those is optional (light red
background in diagram).

Source Port
Source port recognizes the sending port and should be understood to be the port to respond to if
required. If not used, then its value should be zero.

Destination Port
Destination port recognizes the destination port and is mandatory.

Length
A 16-bit length field indicates the length in bytes of the complete datagram: header and data.

Checksum
The 16-bit checksum field is implemented for error-checking of the header and data. The algorithm for
computing the checksum is different for transmission over IPv4 and IPv6.

Additional Reading on UDP


The UDP protocol is defined in RFC 768: User Datagram Protocol.

his User Datagram Protocol (UDP) is defined to make available a


datagram mode of packet-switched computer communication in the
environment of an interconnected set of computer networks. This
protocol assumes that the Internet Protocol (IP) [1] is used as the
underlying protocol.

This protocol provides a procedure for application programs to send


messages to other programs with a minimum of protocol mechanism. The
protocol is transaction oriented, and delivery and duplicate protection
are not guaranteed. Applications requiring ordered reliable delivery of
streams of data should use the Transmission Control Protocol (TCP) [2].

Format
------

0 7 8 15 16 23 24 31
+--------+--------+--------+--------+
| Source | Destination |
| Port | Port |
+--------+--------+--------+--------+
| | |
| Length | Checksum |
+--------+--------+--------+--------+
|
| data octets ...
+---------------- ...

User Datagram Header Format

Fields
------

Source Port is an optional field, when meaningful, it indicates the port


of the sending process, and may be assumed to be the port to which a
reply should be addressed in the absence of any other information. If
not used, a value of zero is inserted.

Postel [page 1]

28 Aug 1980
User Datagram Protocol RFC 768
Fields

Destination Port has a meaning within the context of a particular


internet destination address.

Length is the length in octets of this user datagram including this


header and the data. (This means the minimum value of the length is
eight.)

Checksum is the 16-bit one's complement of the one's complement sum of a


pseudo header of information from the IP header, the UDP header, and the
data, padded with zero octets at the end (if necessary) to make a
multiple of two octets.

The pseudo header conceptually prefixed to the UDP header contains the
source address, the destination address, the protocol, and the UDP
length. This information gives protection against misrouted datagrams.
This checksum procedure is the same as is used in TCP.

0 7 8 15 16 23 24 31
+--------+--------+--------+--------+
| source address |
+--------+--------+--------+--------+
| destination address |
+--------+--------+--------+--------+
| zero |protocol| UDP length |
+--------+--------+--------+--------+

If the computed checksum is zero, it is transmitted as all ones (the


equivalent in one's complement arithmetic). An all zero transmitted
checksum value means that the transmitter generated no checksum (for
debugging or for higher level protocols that don't care).

User Interface
--------------

A user interface should allow

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,

and an operation that allows a datagram to be sent, specifying the


data, source and destination ports and addresses to be sent.

[page 2] Postel

28 Aug 1980
RFC 768 User Datagram Protocol
IP Interface

IP Interface
-------------

The UDP module must be able to determine the source and destination
internet addresses and the protocol field from the internet header. One
possible UDP/IP interface would return the whole internet datagram
including all of the internet header in response to a receive operation.
Such an interface would also allow the UDP to pass a full internet
datagram complete with header to the IP to send. The IP would verify
certain fields for consistency and compute the internet header checksum.

Protocol Application
--------------------

The major uses of this protocol is the Internet Name Server [3], and the
Trivial File Transfer [4].

Protocol Number
---------------

This is protocol 17 (21 octal) when used in the Internet Protocol.


Other protocol numbers are listed in [5].

Vous aimerez peut-être aussi