Re: [GD-General] UDP practical limits
Brought to you by:
vexxed72
From: Colin F. <cp...@ea...> - 2004-04-13 00:42:21
|
2004 April 12th Monday Well, I'll roughly summarize what I encountered while doing Google searching for answers, but perhaps people can add experiences or other hard facts to this thread. The limit for UDP data size is theoretically 65535 bytes, just based on the unsigned 16-bit UDP Message Length field in a UDP datagram. Then this is reduced by 28 bytes due to the fact that IP packets also must be a maximum of 65535 bytes, and require their own fields (headers and final CRC) -- reducing the theoretical UDP data size to 65507 bytes (a number quoted in various sources one can find via Google). However, according to one source, many OSes put an upper limit of 8192 bytes on the UDP receive buffer, which puts further limit on individual UDP packet sizes. (I assume this is after any packet re-assembly after potential fragmentation, since the receive buffer is "session layer"?) Other sources say that the 1526 byte-max Ethernet frame size (Ethernet's "Maximum Transmission Unit" (MTU) size) puts another de facto limit on UDP packet size -- since data larger than the 1500-byte payload limit for a single Ethernet frame is necessarily fragmented, and apparently some routing policies often don't call for working very hard to handle fragmented UDP packets. One source said that really the only way to be confident was to go all the way down to the minimum guaranteed UDP packet size handled by hosts complying with specs: 512 bytes. One source said the following (as a "moral"): "Avoid UDP if you really require reliable transmission of large messages, otherwise you end up reinventing TCP protocol". Clearly UDP is great for many purposes, and TCP is great for many other purposes. Assuming UDP is the right choice for a given purpose, it is interesting to consider the actual constraints imposed by the wild Internet. --- Colin cp...@ea... |