|
UDP Message Format
(Page 1 of 2)
What's the magic word when it comes
to UDP? Right, simple. This is true of the operation of the protocol,
and it is also true of the format used for UDP messages. Interestingly,
however, it is here that we will actually encounter probably the only
aspect of UDP that is not simple. I bet that got you interested,
huh? Okay, well, it was a worth a try. J
In keeping with the goal of efficiency,
the UDP header is only eight bytes in length; this contrasts with the
TCP
header size of 20 bytes or more. Table 147
and Figure 200
show the format of UDP messages.
Table 147: UDP Message Format
Field
Name
|
Size (bytes)
|
Description
|
Source
Port
|
2
|
Source Port: 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. See
the section describing port numbers for details.
|
Destination
Port
|
2
|
Destination
Port: 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. Again,
see
the section describing port numbers for details.
|
Length
|
2
|
Length: The length
of the entire UDP datagram, including both header and Data fields.
|
Checksum
|
2
|
Checksum:
An optional 16-bit checksum computed over the entire UDP datagram plus
a special pseudo header of fields. See below for more information.
|
Data
|
Variable
|
Data: The encapsulated
higher-layer message to be sent.
|
|