Adding OSC args after a Blob in an OSC message

Hello everyone,

I’m having problems sending more than one blob in a single OSC message with ofxOscMessage
The blobs contain very small arrays, so size is not the issue.

When I receive the messages (in Unity), after the first Blob, the offset index to the following arguments is corrupted. This occurs with two different OSC libraries on the receiving side (OSCCore and extOSC), which leads me to ask if perhaps it might be a problem with ofxOsc?
(Stepping through the code in ofx, however, I really cant see anything that might be wrong)

Has anyone successfully managed to add arguments to a message after a Blob arg?
e.g.
ofxOscMessage m;
m.addFloatArg(2.3f);
m.addBlobArg(b1);
m.addBlobArg(b2);
m.addIntArg(3);

best,
MM
(Windows 10)

Hi,
I think ofxOsc is fine, I played a bit with it:

	sender.setup("localhost", 1234);
    
    char b1D[3] = {'o','n','e'};
    char b2D[3] = {'t','w','o'};
    ofBuffer b1(b1D, 3);
    ofBuffer b2(b2D, 3);
    
    int a;
    int* b = &a;
    memset(b, 'x', 4); // Set all 4 bytes of the int to a char 'x', so it's readable in netcat
    
    ofxOscMessage m;
    m.addIntArg(a);
    m.addBlobArg(b1);
    m.addIntArg(a);
    m.addBlobArg(b2);
    m.addIntArg(a);
    m.setAddress("/test");
    
    sender.sendMessage(m);

Then in Terminal I receive the following with netcat (nc -u -l 1234):
#bundle,/test,ibibixxxxonexxxxtwoxxxx
And when receiving in SuperCollider, with:
o = OSCFunc({|msg| msg.postln}, "/test", recvPort: 1234);
I read:
[ /test, 2021161080, Int8Array[ 111, 110, 101 ], 2021161080, Int8Array[ 116, 119, 111 ], 2021161080 ]
So to answer your question: yes, I have succesfully managed to add arguments to a message after a Blob arg.

Hope this info helps!
(OSX 11.15.7, OF_0.11.2, SC 3.11.1)

1 Like