This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ttings/bigini/Docu...homenet2run/tcpip/tcp-ip-illustrated/udp_user.htm (1 of 29) [12/09/2001 14.46.58] Chapter 11. UDP: User Datagram Protocol Figure 11.2 UDP header.
The port numbers identify the sending process and the receiving process. In Figure 1.8 we
showed that TCP and UDP use the destination port number to demultiplex incoming data from
IP. Since IP has already demultiplexed the incoming IP datagram to either TCP or UDP (based
on the protocol value in the IP header), this means the TCP port numbers are looked at by TCP,
and the UDP port numbers by UDP. The TCP port numbers are independent of the UDP port
Despite this independence, if a well-known service is provided by both TCP and UDP, the port
number is normally chosen to be the same for both transport layers. This is purely for
convenience and is not required by the protocols.
The UDP length field is the length of the UDP header and the UDP data in bytes. The minimum
value for this field is 8 bytes. (Sending a UDP datagram with 0 bytes of data is OK.) This UDP
length is redundant. The IP datagram contains its total length in bytes (Figure 3.1), so the length
of the UDP datagram is this total length minus the length of the IP header (which is specified by
the header length field in Figure 3.1). 11.3 UDP Checksum
The UDP checksum covers the UDP header and the UDP data. Recall that the checksum in the
IP header only covers the IP header-it does not cover any data in the IP datagram. Both UDP
and TCP have checksums in their headers to cover their header and their data. With UDP the
checksum is optional, while with TCP it is mandatory.
Although the basics for calculating the UDP checksum are similar to what we described in
Section 3.2 for the IP header checksum (the ones complement sum of 16-bit words), there are
differences. First, the length of the UDP datagram can be an odd number of bytes, while the
checksum algorithm adds 16-bit words. The solution is to append a pad byte of 0 to the end, if
necessary, just for the checksum computation. (That is, this possible pad byte is not
Next, both UDP a...
View Full Document
This test prep was uploaded on 04/04/2014 for the course ECE EL5373 taught by Professor Guoyang during the Spring '12 term at NYU Poly.
- Spring '12