"Why does the TCP header have a header length field while the UDP header does not?" Is this a valid question?

Viewed 1989

My question is the inverse of this one asked on Stack Overflow: InverseQuestion

...but I don't think I get an unequivocal answer to what I'm seeking from that either. My question was posed on a mid-term I just took and was worth A LOT of points. I argued that it was not a legitimate question because the UDP header DOES have a length field (that speaks to the header and data), as shown in the screenshot I'm embedding. I could list dozens of references that have a similar diagram and explanation. The instructor simply marked it wrong with no explanation. We have been going back and forth since then and I can't get an answer as to why every UDP header diagram on the internet shows a length field if there is no length! Can someone help me understand--if it's true there is no header length--in plain English? Am I misinterpreting all these similar diagrams? Thanks. UDP Diagram

https://www.computernetworkingnotes.com/ccna-study-guide/segmentation-explained-with-tcp-and-udp-header.html https://www.lifewire.com/tcp-headers-and-udp-headers-explained-817970

1 Answers

Why does the TCP header have a header length field while the UDP header does not? might be a valid question.

  • UDP header contains the header+data length
  • TCP header contains the header length in 32b DWORD
  • IP header contains the total length of the IP packet

Important:

  • UDP header is fixed 8 Bytes => no meaning to make the header bigger for a constant
  • TCP header can vary with options

If you're looking for the reason why UDP includes the data and TCP doesn't, you can check in the draft of each RFC specification. Nevertheless, there might not be any reason for that, don't forget those protocols have been defined tens years ago.

Related