I want to stuff data into a packet, but I want to make sure that the packet does not exceed 512 bytes, so I need to know what the initial size of a UDP packet is so I know how much data I can put into the packet. I did some snooping around on Google, but I found answers that were contradictory. I'm using IPv6. Thanks in advance to anyone who replies!
Why not start with the RFCs or Wikipedia:
- UDP: http://tools.ietf.org/html/rfc768 and http://en.wikipedia.org/wiki/User_Datagram_Protocol
- IPv6: http://tools.ietf.org/html/rfc2460 and http://en.wikipedia.org/wiki/IPv6_packet
Result: 40 Byte for the minimal fixed IPv6 header and 8 byte for the UDP header
But: IPv6 has extension headers of variable length. Some of them can (theoetically) reach a length of 256 Bytes, so it's entirely possible to have a packet exceeding 512 byes without any payload.