Raspberry PI - UDP Packet, maybe too large?

Hello, I’m sending an UDP packet of exactly 1195 bytes, and it runs OK in macOS but in raspbian stretch it works ok too but I get an error message

[ error ] ofxNetwork: /home/pi/openFrameworks/addons/ofxNetwork/src/ofxUDPManager.cpp: 295 
EMSGSIZE: the socket type requires that the message be sent atomically, 
but the message is too large for this to be possible

Is ther some configuration I should change in rasp or in of app?
Thank you

this is an operating system thing not OF, you can change the MTU calling:

ip link set mtu 2000 dev eth0

where eth0 would be the device you want to change the MTU for. you can query the available devices with

ip link

The problem with this is that the maximum package size is not only dependent on the OS but also on the network you are using and any element on it so if your router has an MTU smaller than that you might get into trouble cause packages might be divided or lost. The minimum MTU is 576 minus the header, around 556bytes.

TCP solves all of this issues so unless you really need UDP for some reason TCP is much safer and easy to use except for very simple things

1 Like

Gracias @arturo. If I remember well the standard is 1500 bytes, I think I’m good with the router and switch from what I’ve seen in macOS.
As it is an image streaming to LEDs I think UDP is best, packets can be lost and we wont have delay. Just wondering if I have to use something like this:


Thank you