- User Datagram Protocol
User Datagram Protocol (UDP) is one of the core protocols of the
Internet Protocol Suite. Using UDP, programs on networked computers can send short messages sometimes known as "datagrams" (using Datagram Sockets) to one another. UDP is sometimes called the Universal Datagram Protocol. The protocol was designed by David P. Reed in 1980and formally defined in RFC 768.
UDP does not guarantee reliability or ordering in the way that TCP does. Datagrams may arrive out of order, appear duplicated, or go missing without notice. Avoiding the overhead of checking whether every packet actually arrived makes UDP faster and more efficient, for applications that do not need guaranteed delivery. Time-sensitive applications often use UDP because dropped packets are preferable to delayed packets. UDP's stateless nature is also useful for servers that answer small queries from huge numbers of clients. Unlike TCP, UDP is compatible with packet broadcast (sending to all on local network) and multicasting (send to all subscribers).
Common network applications that use UDP include: the
Domain Name System(DNS), streaming mediaapplications such as IPTV, Voice over IP(VoIP), Trivial File Transfer Protocol(TFTP) and online games.
UDP uses ports to allow application-to-application communication.The port field is a 16
bitvalue, allowing for port numbers to range between 0 and 65,535.Port 0 is reserved, but is a permissible source port value if the sending process does not expect messages in response.
Ports 1024 through 49,151 (hex BFFF) are
UDP is a minimal message-oriented
Transport Layerprotocol that is currently documented in IETFRFC 768.
Internet Protocol Suite, UDP provides a very simple interface between the Internet Layerbelow (e.g., IPv4) and the Application Layerabove.
UDP provides no guarantees to the
upper layer protocolfor message delivery and a UDP sender retains no state on UDP messages once sent (for this reason UDP is sometimes called the "Unreliable" Datagram Protocol).UDP adds only application multiplexingand checksumming of the header and payload. If any kind of reliability for the information transmitted is needed, it must be implemented in upper layers.
::The source address is the one in the
IPv6header. The destination address is the final destination; if the IPv6packet doesn't contain a Routing header, that will be the destination address in the IPv6header; otherwise, at the originating node, it will be the address in the last element of the Routing header, and, at the receiving node, it will be the destination address in the IPv6header. The Next Header value is the protocol value for UDP: 17. The UDP length field is the length of the UDP header and data.
::If the checksum is calculated to be zero (all 0s) it should be sent as negative zero (all 1's).
Lacking reliability, UDP applications must generally be willing to accept some loss, errors or duplication. Some applications such as TFTP may add rudimentary reliability mechanisms into the application layer as needed. Most often, UDP applications do not require reliability mechanisms and may even be hindered by them.
Streaming media, real-time multiplayer games and voice over IP(VoIP) are examples of applications that often use UDP. If an application requires a high degree of reliability, a protocol such as the Transmission Control Protocolor erasure codes may be used instead.
Lacking any congestion avoidance and control mechanisms, network-based mechanisms are required to minimize potential congestion collapse effects of uncontrolled, high rate UDP traffic loads. In other words, since UDP senders cannot detect congestion, network-based elements such as routers using packet queuing and dropping techniques will often be the only tool available to slow down excessive UDP traffic. The
Datagram Congestion Control Protocol(DCCP) is being designed as a partial solution to this potential problem by adding end host TCP-friendly congestion control behavior to high-rate UDP streams such as streaming media.
While the total amount of UDP traffic found on a typical network is often in the order of only a few percent, numerous key applications use UDP, including: the
Domain Name System(DNS) (since most DNS queries only consist of a single request followed by a single reply), the simple network management protocol(SNMP), the Dynamic Host Configuration Protocol(DHCP) and the Routing Information Protocol(RIP).
=Sample code (Python) =
The following, minimalistic example shows how to use UDP for client/server communication:
The client (replace "127.0.0.1" by the IP address of the server):
=Sample code (C – Windows-specific) =
The following, minimalistic example shows how to use UDP for client/server communication:
The server:The client:
Voice and Video Traffic
Voice and video traffic is generally transmitted using UDP. Real-time video and audio streaming protocols are designed to handle occasional lost packets, so only slight degradation in quality (if any) occurs rather than large delays as lost packets are retransmitted. Because both TCP and UDP run over the same network, many businesses are finding that a recent increase in UDP traffic from these real-time applications is hindering the performance of applications using TCP, such as
point of sale, accounting, and database systems. When TCP detects packet loss, it will throttle back its bandwidth usage which allows the UDP applications to consume even more bandwidth, worsening the problem. Since both real-time and business applications are important to businesses, developing quality of servicesolutions is crucial. [ [http://www.networkperformancedaily.com/2007/08/whiteboard_series_nice_guys_fi.html The impact of UDP on Data Applications] ]
Difference between TCP and UDP
TCP ("Transmission Control Protocol") is a connection-oriented protocol, which means that upon communication it requires handshaking to set up end-to-end connection. A connection can be made from client to server, and from then on any data can be sent along that connection.
*Reliable - TCP manages message acknowledgment, retransmission and timeout. Many attempts to reliably deliver the message are made. If it gets lost along the way, the server will re-request the lost part. In TCP, there's either no missing data, or, in case of multiple timeouts, the connection is dropped.
*Ordered - if two messages are sent along a connection, one after the other, the first message will reach the receiving application first. When data packets arrive in the wrong order, the TCP layer holds the later data until the earlier data can be rearranged and delivered to the application.
*Heavyweight - TCP requires three packets just to set up a socket, before any actual data can be sent. It handles connections, reliability and
congestion control. It is a large transport protocol designed on top of IP.
*Streaming - Data is read as a "stream," with nothing distinguishing where one packet ends and another begins. Packets may be split or merged into bigger or smaller data streams arbitrarily.
UDP is a simpler message-based
connectionless protocol. In connectionless protocols, there is no effort made to setup a dedicated end-to-end connection. Communication is achieved by transmitting information in one direction, from source to destination without checking to see if the destination is still there, or if it is prepared to receive the information. With UDP messages (packets) cross the network in independent units.
*Unreliable - When a message is sent, it cannot be known if it will reach its destination; it could get lost along the way. There is no concept of acknowledgment, retransmission and timeout.
*Not ordered - If two messages are sent to the same recipient, the order in which they arrive cannot be predicted.
*Lightweight - There is no ordering of messages, no tracking connections, etc. It is a small transport layer designed on top of IP.
*Datagrams - Packets are sent individually and are guaranteed to be whole if they arrive. Packets have definite bounds and no split or merge into data streams may exist.
TCP and UDP port numbersfor a partial (growing) listing of ports/services
UDP flood attack
UDP Data Transport
UDP Lite, a variant that will deliver packets even if they are malformed
Reliable User Datagram Protocol(RUDP)
Transmission Control Protocol
* IP or Internet Protocol, on top of which rests UDP
* Transport protocol comparison table
* RFC 768, "User Datagram Protocol", J. Postel, August 1980
* [http://www.iana.org/assignments/port-numbers IANA Port Assignments]
* [http://condor.depaul.edu/~jkristof/papers/udpscanning.pdf The Trouble with UDP Scanning (PDF)]
* [http://www.networksorcery.com/enp/protocol/udp.htm Breakdown of UDP frame]
* [http://msdn.microsoft.com/msdnmag/issues/06/02/UDP/ UDP on MSDN Magazine Sockets and WCF]
Wikimedia Foundation. 2010.
Look at other dictionaries:
User datagram protocol — Pour les articles homonymes, voir UDP. Pile de protocoles 7 • Application 6 • … Wikipédia en Français
User Datagram Protocol — (UDP) es un protocolo del nivel de transporte basado en el intercambio de datagramas. Permite el envío de datagramas a través de la red sin que se haya establecido previamente una conexión, ya que el propio datagrama incorpora suficiente… … Enciclopedia Universal
User Datagram Protocol — User Datagram Protocol, UDP … Universal-Lexikon
User Datagram Protocol — UDP (User Datagram Protocol) Familie: Internetprotokollfamilie Einsatzgebiet: Verbindungslose Übertragung von Daten über das Internet UDP im TCP/IP‑Protokollstapel: Anwendung DNS DHCP … … Deutsch Wikipedia
User Datagram Protocol — Para otros usos de este término, véase UDP (desambiguación). User Datagram Protocol (UDP) Familia: Familia de protocolos de Internet Función: Intercambio de datagramas a través de una red. Ubicación en la pila de protocolos … Wikipedia Español
User Datagram Protocol — UDP Название: User Datagram Protocol Уровень (по модели OSI): Транспортный Семейство: TCP/IP (иногда называют UDP/IP) Порт/ID: 17 (в IP) Спецификация: RFC 768 / STD 6 Основные реализации (клиенты): Ядро Windows, Linux, UNIX … Википедия
User Datagram Protocol — Pour les articles homonymes, voir UDP. Pile de protocoles 7. Application 6. … Wikipédia en Français
User Datagram Protocol — Abbreviated UDP. The connectionless, transport level protocol used in the TCP/IP suite of protocols, usually bundled with IP layer software. Because UDP does not add overhead, as does connection oriented TCP, UDP is often used with SNMP… … Dictionary of networking
user datagram protocol — noun A communications protocol that has no error recovery features, and is mostly used to send streamed material over the Internet … Wiktionary
User Datagram Protocol — UDP, protocol with no connection required between sender and receiver that allows sending of data packets on the Internet (thought unreliable because it cannot ensure the packets will arrive undamaged or in the correct order) … English contemporary dictionary