Partager via


User Datagram Protocol (UDP)

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

User Datagram Protocol (UDP)

User Datagram Protocol (UDP) is a TCP/IP standard defined in RFC 768, "User Datagram Protocol (UDP)." UDP is used by some programs instead of TCP for fast, lightweight, unreliable transportation of data between TCP/IP hosts.

UDP provides a connectionless datagram service that offers best-effort delivery, which means that UDP does not guarantee delivery or verify sequencing for any datagrams. A source host that needs reliable communication must use either TCP or a program that provides its own sequencing and acknowledgment services.

UDP messages are encapsulated and sent within IP datagrams, as shown in the following illustration.

UDP encapsulation in an IP datagram

UDP ports

UDP ports provide a location for sending and receiving UDP messages. A UDP port functions as a single message queue for receiving all datagrams intended for the program specified by each protocol port number. This means UDP-based programs can receive more than one message at a time.

The server side of each program that uses UDP listens for messages arriving on their well-known port number. All UDP server port numbers less than 1,024 (and some higher numbers) are reserved and registered by the Internet Assigned Numbers Authority (IANA).

Each UDP server port is identified by a reserved or well-known port number. The following table shows a partial list of well-known UDP server port numbers that are used by standard UDP-based programs.

UDP port number Description

53

DNS name queries

69

Trivial File Transfer Protocol (TFTP)

137

NetBIOS name service

138

NetBIOS datagram service

161

Simple Network Management Protocol (SNMP)

520

Routing Information Protocol (RIP)

For an updated, complete list of all currently registered well-known UDP ports, see the Internet Assigned Numbers Authority (IANA) Web site.

Note

UDP and TCP

In general, differences in how UDP and TCP deliver data are similar to the differences between a telephone call and a postcard. TCP works like a telephone call by verifying that the destination is available and ready to communicate. UDP works like a postcard--messages are small and delivery is likely, but not always assured.

UDP is typically used by programs that transmit small amounts of data at one time or have real-time requirements. In these situations, the low overhead and multicasting capabilities of UDP (for example, one datagram, many recipients) are better suited than TCP.

UDP contrasts directly with the services and features provided by TCP. The following table compares differences in how TCP/IP communication is handled depending on whether UDP or TCP is used for transporting data.

UDP TCP

Connectionless service; no session is established between hosts.

Connection-oriented service; a session is established between hosts.

UDP does not guarantee or acknowledge delivery, or sequence data.

TCP guarantees delivery through the use of acknowledgments and sequenced delivery of data.

Programs that use UDP are responsible for providing any reliability needed to transport data.

Programs that use TCP are provided assurance of reliable data transport.

UDP is fast, has low overhead requirements, and can support point-to-point and point-to-multipoint communication.

TCP is slower, has higher overhead requirements, and only supports point-to-point communication.

Both UDP and TCP use ports to identify communications for each TCP/IP program.