Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why UDP header has 'length field'?

I couldn't understand why UDP header has 'length' field, and why it is needed?

If the reason is to know where the 'application message(L5 data)' begins in the segment, it can just be gotten from 'UDP data - UDP header length(it is already known value)'.

like image 708
user7159879 Avatar asked Dec 30 '16 10:12

user7159879


2 Answers

Because UDP can be transmitted over another protocol than IP.

And also because UDP transmits datagram messages with a length (udp length) which can be sent over multiple IP fragmented packets. enter image description here

Source: https://notes.shichao.io/tcpv1/ch10/

like image 132
franckspike Avatar answered Sep 19 '22 04:09

franckspike


The UDP header length field is the length of the UDP header plus the UDP data. It is indeed redundant since this length can be calculated from the IP header total length field where the UDP datagram length is the IP total length minus the IP header length.

like image 26
Ton Plooij Avatar answered Sep 18 '22 04:09

Ton Plooij