The following are the definitions of the fields in the UDP segment:
Source port number
- This is the port number used by the process running on the source host.
- It is 16 bits long, which means that the port number can range from 0 to 65,535.
- If the source host is the client, the port number, in most cases, is an ephemeral port number requested by the process and chosen by the UDP software running on the source host.
- If the source host is the server, the port number, in most cases, is a well-known port number.
Destination port number
- This is the port number used by the process running on the destination It is also 16 bits long.
- If the destination host is the server, the port number, in most cases, is a well-known port number.
- If the destination host is the client, the port number, in most cases, is an ephemeral port number.
Length
- This is a 16-bit field that defines the total length of the user datagram, header plus data.
- The 16 bits can define a total length of 0 to 65,535 The length field in a UDP user datagram is actually not necessary.
Checksum
- This field is used to detect errors over the entire user datagram (header plus data).