Re: max udp datagram size

From: Phil Frisbie, Jr. (
Date: 02/13/04

Date: Fri, 13 Feb 2004 21:46:41 GMT

Artem Baguinski wrote:

> hi
> is there the maximum UDP datagram size?

getsockopt() with SO_MAX_MSG_SIZE option will get you the size, but it is
normally 65508 bytes.

> is there some recomendation to chose one based on the application /
> network?

Due to packet loss, generally apps do not send UDP packets larger than 16K. And
it is most efficient to send a multiple of the MTU less the UDP header size, or
for Ethernet 1500 - 28 = 1472 bytes.

> i have to send video over unreliable WiFi connection from a boat to
> shore along with some control data in both directions. probably i'll
> chose some existing transport / application layer protocol in the
> end, but in a course if experiments i just started to wonder about
> these UDP datagrams. it seems that if i try to send too large packets
> i get "Bad address" error, but i can't find any documentation as too
> what's the limit if any.
> thanks

Phil Frisbie, Jr.
Hawk Software