obive.net

UDP Message Sizes

Monday October 5, 2009 @ 7:52 PM EST

Sending DatagramPackets in Java will throw a java.io.IOException: Message too long.

Seems the maximum message size on Windows is (64KiB -28B) = 65508 (I have no idea where that 28 came from) and on MacOSX (at least on 10.5.8 on my MacPro) is 9KiB (9216B). These were determined from incrementing the size of the message from 1 until the IOException was thrown. The big surprise is when you develop on a Windows box and you run your app on a Mac and the DataGramPackets never arrive.