What to do if OSC package too big?
enzyme69 opened this issue · 2 comments
I am making this app where there is a huge data being sent, I am getting error message:
"OSCPacket is too large. Must be smaller than 9200 bytes"
Wondering what would be the solution of this? If I separate the OSC data into many2 ports, would it actually works?
The data contains:
- 16 floating value matrix x 2
- 1220 points XYZ floating values
- some 60+ floating value
That's a limitation of the UDP network protocol. OSC is intended to be a fast way to send small amounts of data. I'd suggest breaking your data up into a series of smaller groupings, and send several OSC messages in a row, then have your receiving code assemble them after receiving all the messages.
Like Stef said UDP has a limit and I would follow his recommendation.
Although the theoretical limit is 65,507 bytes, operating systems usually have an arbitrary limits which are much smaller. macOS has a UDP limit of 9216 bytes so I set a 9200 byte limit in SwiftOSC to be safe. It's possible to change the limit on the OS but you're on your own if you choose to go down that path. If I didn't add the warning you'd be wondering why you weren't receiving your OSC messages. The OS drops the larger packages without warning.
If you're sending messages over the internet you run into additional limitations and it's recommended to keep you packet sizes under 512 bytes.