Overview of UDP protocol.
UDP (User Datagram Protocol) is a simple extension of the Internet Protocol services. It basically provides simple packet transport service without any quality of service functions.
Unlike TCP, UDP is connection-less and packet-based. Application PDUs (application packets) sent over a UDP socket are delivered to the receiving host application as is without fragmentation.
UDP is mostly used by applications with simple request-response communication patterns like DNS, DHCP, RADIUS, RIP or RPC.
Since UDP does provide any error recovery such as retransmission of lost packets, the application protocols have to take care of these situations.
1. Š Peter R. Egli 2015
1/7
Rev. 3.50
UDP - User Datagram Protocol indigoo.com
INTRODUCTION TO USER DATAGRAM PROTOCOL,
A SIMPLE PACKET TRANSPORT SERVICE IN THE
INTERNET PROTOCOL SUITE
PETER R. EGLI
INDIGOO.COM
USER DATAGRAM PROTOCOL
UDP
2. Š Peter R. Egli 2015
2/7
Rev. 3.50
UDP - User Datagram Protocol indigoo.com
Contents
1. UDP (RFC768) characteristics
2. UDP Service
3. Typical UDP applications
4. UDP Checksum
5. UDP versus TCP
3. Š Peter R. Egli 2015
3/7
Rev. 3.50
UDP - User Datagram Protocol indigoo.com
1. UDP (RFC768) characteristics
⢠No connection establishment/teardown; data is just sent right away.
⢠No flow control / congestion control, sender can overrun receiverâs buffer:
ď¨ UDP is not suited for bulk data transfer.
ď¨ For data transfer with UDP a lock-step protocol is required (to be implemented
by the application).
⢠No error control; corrupted data is not retransmitted (even though UDP header has a
checksum to detect errors and report these to the application).
Packet 4 is
dropped (buffer
overrun).
Host 1 Host 2
Packet 1 is sent
to the application.
Packet 4 is missing. The
packet loss needs
to be handled by
the application
(detection, retransmission).
1
Packet 1 is stored
in the receive queue.
1
2
1
2
1
2
3
4
3
1
2
3
5
Packet 2 is stored
in the receive queue.
Packet 3 is stored
in the receive queue.
2
3
5
1
Host 1 sends
packets.
4. Š Peter R. Egli 2015
4/7
Rev. 3.50
UDP - User Datagram Protocol indigoo.com
2. UDP service
ď¨ UDP is basically a simple extension of the IP datagram service.
ď¨ UDP adds multiplexing (on port number) to IP datagram service.
ď¨ Application writes are mapped 1:1 to UDP datagrams; UDP passes these 1:1 to the IP layer.
UDP layer
Appl.
IP packets
Application
sends packets
(APDUâs) over
the socket
interface
Socket interface
IP layer
2500
300
500
150
TPDUâs
(UDP datagrams)
2500
300
500
150
300 500 15015001000
IP layer
300
2500
500
150
UDP layer
300
2500
500
150
Appl.
Application
reads packets
(APDUâs)
from the
socket
interface
TPDUâs
(UDP datagrams)
2500byte packet is too big. IP layer fragments
the UDP datagram.
5. Š Peter R. Egli 2015
5/7
Rev. 3.50
UDP - User Datagram Protocol indigoo.com
3. Typical UDP applications
UDP is best suited for applications with short command-response type âtransactionsâ
that do not justify the establishment / release prior to the data exchange.
Host 1 Host 2
SNMP GET Request
SNMP GET Response
SNMP Host 1 Host 2
DNS Query
DNS Response
DNS Host 1 Host 2
Time request
Time response
SNTP
Host 1 Host 2
DHCP Request
DHCP Response
DHCP/Bootp Host 1 Host 1 Host 2
RIP Route Update
RIPHost 2
RADIUS Access Request
RADIUS
RADIUS Access Accept
Host 1 Host 2
RPC Request
RPC Reply
RPC
6. Š Peter R. Egli 2015
6/7
Rev. 3.50
UDP - User Datagram Protocol indigoo.com
4. UDP checksum
ď¨ UDP has a checksum too that provides minimal protection against transmission errors.
ď¨ The checksum is optional; if it is not used it shall be set to 0.
ď¨ Becaus the IP addresses are used in the UDP checksum calculation,
UDP is tightly bound to the IP layer. Therefore UDP can only run on top of IP.
Pseudo
header
The checksum is
calculated over
the pseudo header,
UDP header and
data (UDP payload).
Source Port Destination Port
Checksum Length
Data
UDP Length00000000 Protocol=17 UDP Length
IP Destination Address
IP Source Address
UDP
header
7. Š Peter R. Egli 2015
7/7
Rev. 3.50
UDP - User Datagram Protocol indigoo.com
5. UDP versus TCP
TCP
ď¨ Connection-oriented, point-to-point (unicast)
ď¨ Reliable end-to-end:
No bit errors due to checksum.
Packet ordering preserved.
No duplicates.
No packet loss.
ď¨ Stream-oriented (no message boundary preservation)
ď¨ Has flow control to maximise throughput
ď¨ Has congestion control to minimise packet loss
ď¨ Analogon: phone
Examples of application protocols using TCP:
HTTP, SMTP, FTP, TELNET
UDP
ď¨ Connection-less, best-effort
ď¨ Not reliable (no retransmissions)
ď¨ Message boundary preservation
ď¨ No flow control
ď¨ No congestion control
ď¨ Analogon: mail (snail mail)
Examples of application protocols
using UDP:
SNMP, DNS, TFTP, RTP, DHCP, SNTP
N.B.: It is possible to run application protocols over both TCP and UDP. E.g. DNS is normally run on UDP, but
for zone transfers (higher data volume) DNS uses TCP. Actually there is a shift towards using TCP instead
UDP since TCP can better provide security (SSL/TLS, simpler filtering in firewalls etc.).