public DatagramPacket(byte[] buf,int length)
// Constructs a DatagramPacket for receiving packets of length length.
Using the vanilla Java classes for a UDP server (DatagramSocket), how am I supposed to calculate the buffer size for an incoming packet?
I have looked through the javadocs, and there seems to be a method called getReceiveBufferSize(), but I really don’t know what I would use the returned data for.
Assuming you have no other clue from your app/protocol requirements/spec, 64K is a good size – it will never be too small.