80 likes | 101 Views
UDP - User Datagram Protocol. UDP – User Datagram Protocol. Author : Nir Shafrir Reference The TCP/IP Guide - ( http://www.TCPIPGuide.com ) Version 3.0 - Version Date: September 20, 2005. UDP - User Datagram Protocol. UDP OVERVIEW.
E N D
UDP - User Datagram Protocol UDP – User Datagram Protocol Author : Nir Shafrir Reference The TCP/IP Guide - (http://www.TCPIPGuide.com) Version 3.0 - Version Date: September 20, 2005
UDP - User Datagram Protocol UDP OVERVIEW UDP is asimpleprotocol that uses a very straight-forwardmessagingstructure that is similar to the message format used by many other TCP/IP protocols (in contrast to the more complexdatastructures—streams and segments—used by TCP). The only real goal of the protocol is to serve as aninterfacebetween networking application processes running at the higher layers, and the internetworking capabilities of IP. Like TCP, UDP layers on top of IP a method oftransport-layer addressing (and hence, process identification) through the use of UDP port numbers. It does include an optional checksum capability for error-detection, but adds virtually no other functionality.
UDP - User Datagram Protocol UDP OPERATION What UDP Does? UDP's only real task is to take data from higher-layer protocols and place it in UDP messages, which are then passed down to the Internet Protocol for transmission. The basic steps for transmission using UDP are: Higher-LayerDataTransfer:An application sends a message to the UDP software. UDP Message Encapsulation:The higher-layer message is encapsulated into theDatafield of a UDP message. The headers of the UDP message are filled in, including theSource Portof the application that sent the data to UDP, and theDestination Portof the intended recipient. The checksum value may also be calculated. Transfer Message To IP:The UDP message is passed to IP for transmission. And that's about it. Of course, on reception at the destination device this short procedure is reversed.
UDP - User Datagram Protocol UDP OPERATION What UDP Does Not? In fact, UDP is so simple, that its operation is very often described in terms of what it does not do, instead of what it does. As a transport protocol, some of the most important things UDP does not do include the following: UDP does not establish connections before sending data. It just packages it and… off it goes. UDP does not provide acknowledgments to show that data was received. UDP does not provide any guarantees that its messages will arrive. UDP does not detect lost messages and retransmit them. UDP does not ensure that data is received in the same order that they were sent. UDP does not provide any mechanism to manage the flow of data between devices, or handle congestion.
UDP - User Datagram Protocol UDP MESSAGE FORMAT SourcePort: 2 bytes The 16-bit port number of the process that originated the UDP message on the source device. This will normally be an ephemeral (client) port number for a request sent by a client to a server, or a well-known/registered (server) port number for a reply sent by a server to a client
UDP - User Datagram Protocol UDP MESSAGE FORMAT Destination Port: 2 bytes The 16-bit port number of the process that is the ultimate intended recipient of the message on the destination device. This will usually be a well-known/registered (server) port number for a client request, or an ephemeral (client) port number for a server reply.
UDP - User Datagram Protocol UDP MESSAGE FORMAT Length: 2 bytes The length of the entire UDP datagram, including both header and Data fields. Checksum: 2 bytes An optional 16-bit checksum computed over the entire UDP datagram plus a special “pseudo header” of fields, which will be shown and explained later. Data: Variable The encapsulated higher-layer message to be sent.
UDP - User Datagram Protocol The Checksum Field and the UDP Pseudo Header The only part that is tricky in UDP is that instead of calculating the checksum over just the fields in the UDP datagram itself, the UDP software first constructs a “fake” additional header that contains the following fields: The IP Source Address field. The IP Destination Address field. The IP Protocol field. The UDP Length field. The total length of this “pseudo header” is 11 bytes. It is padded to 12 bytes with a byte of zeroes and then prepended to the real UDP message. The checksum is then computed over the combination of the pseudo header and the real UDP message, and the value is placed into the Checksum field. The pseudo header is used only for this calculation and is then discarded; it is not actually transmitted. The UDP software in the destination device creates the same pseudo header when calculating its checksum to compare to the one transmitted in the UDP header.