I am usually sending packets that range from 3 to 15 KB but from time to time I need to send a large packet which is about 0.8-0.9 MB. In that case the UDP socket will stop because there is probably some limit on a single packet size.
How can I increase this limit so I can send large packets?
The
lengthfield in the UDP packet header is only 16 bits in width; you can’t have a single UDP packet larger than 65,535 bytes (that includes the header, too, so really the limit is 65,527 bytes; it’s probably even lower still since IP has other restrictions).