UDP Header
UDP Header
UDP Header
guaranteed datagram delivery -- and gives applications direct access to the datagram
service of the IP layer. UDP is used by applications that do not require the level of
service of TCP or that wish to use communications services (e.g., multicast or
broadcast delivery) not available from TCP.
UDP is almost a null protocol; the only services it provides over IP are checksumming
of data and multiplexing by port number. Therefore, an application program running
over UDP must deal directly with end-to-end communication problems that a
connection-oriented protocol would have handled -- e.g., retransmission for reliable
delivery, packetization and reassembly, flow control, congestion avoidance, etc.,
when these are required. The fairly complex coupling between IP and TCP will be
mirrored in the coupling between UDP and many applications using UDP.
UDP header:
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Source Port Destination Port
Length Checksum
Data :::
Length. 16 bits.
The length in bytes of the UDP header and the encapsulated data. The minimum value
for this field is 8.
Checksum. 16 bits.
Computed as the 16-bit one's complement of the one's complement sum of a pseudo
header of information from the IP header, the UDP header, and the data, padded as
needed with zero bytes at the end to make a multiple of two bytes. If the checksum is
cleared to zero, then checksuming is disabled. If the computed checksum is zero, then
this field must be set to 0xFFFF.
When transported by IPv4, the pseudo header contains the following fields:
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Source IPv4 address
Destination IPv4 address
0 Protocol Total length
The checksum is not optional when transported by IPv6. In this case, the pseudo
header contains the following fields:
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Source IPv6 address :::
Destination IPv6 address :::
Upper layer packet length
0 Next header