UDP data length in Ethernet and WiFi libraries


do i see correctly that neither of these libraries return the length field from the UDP header? (Or some variation of it)

That seems like an oversight. Atleast the Ethernet library is calculating length of the packet by measuring available data, but has no function to return the header value. I know, it could be corrupted, but still ;)

I tried to also check the WiFi library, but it the function calls are so nested and the later stuff isn't documented much, so i'm not sure if the behavior is identically. But there is definitely one difference: WiFi simply calls available() on parsePacket(), while Ethernets available() should not work without calling parsePacket() first (which actually does stuff).

Both the wifi and ethernet parsePacket() functions return the size of the data packet, not the length of the data contained in it. Or it returns zero if no packet received.

The UDP header size is 8 byte. The rest then is math.