The maximum length of a Datagram Packet is 65,536 or 65,535?

I found both answers on the internet.

I think it should be 2 bytes = 2^16 = 65,536, but on Wikipedia it is written that it is 65,535 :

The field size sets a theoretical limit of 65,535 bytes (8-byte header + 65,527 bytes of data) for a UDP datagram.

Why is 1 byte missing?

7

2 Answers

Reddy's hit the nail on the head:

The maximum IP packet size is 65,535 bytes (216-1), including all headers and usually requiring fragmentation. Assuming standard headers, IPv4 uses 20 bytes and UDP 8 bytes. The resulting maximum UDP payload size over IPv4 is 65,507 bytes. The maximum UDP datagram includes the UDP header and is 65,515 bytes. For completeness, UDP over IPv6 is 20 bytes less.

If you tried to leverage the theoretical maximum UDP datagram length of 65,535 bytes you couldn't use IP to transport it with.

65,535 is the maximum value you can store in 16 bits - the largest number is binary 1111 1111 1111 1111 = decimal 65,535. There are 65,536 different values, including 0000 0000 0000 0000.

The length field is 16 bit and can thus represent sizes between 0 and 65535. Wikipedia and others are right .

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like