ofxOscMessage - Sending Bunles of packets


I can’t seem to be able to send a OSC bundle in OF. It seems only individual packets are able to send.

I have the following code:

//Set Message  
ofxOscMessage m1;  
m1.addIntArg(contourFinder.blobs[i].id); //id  
m1.addFloatArg(transformX);  // x  
m1.addFloatArg(transformY); // y   
TUIOSocket.sendMessage(m1 );  
 //Send alive message of all alive IDs  
ofxOscMessage m2;  
for(int i=0; i<contourFinder.nBlobs; i++)  
m2.addIntArg(contourFinder.blobs[i].id); //Get list of ALL active IDs             
TUIOSocket.sendMessage(m2);//send them            
//Send fseq message  
ofxOscMessage m3;  
m3.setAddress( "/tuio/2Dcur" );           
m3.addStringArg( "fseq" );  
TUIOSocket.sendMessage( m3 );                        

The code above works, but instead of sending messages 3 times, I’d like to send each packet once as a bundle. Is there a way to do this in OF? In order to get this working I had to create 3 different messages (since I have 3 different addStringsArgs). It didn’t seem to work any other way I tried.

Any help on sending a Bundle with multiple packets/messages inside would be great.


yeah, when i wrote the ofxOsc classes i skipped out on the concept of bundles, basically because i don’t ever use them myself. what’s wrong with sending 3 times? the UDP protocol has almost no overhead, so it makes no difference, really…

if you’re really keen you could try to extend ofxOsc by adding a new argument type that represents a Bundle, which can have different Arguments inside it. have some kind of push/pop system on the ofxOscMessage class, and deal with all the joy of unwrapping bundles in the ofxOscReceiver class.

or just add a new message to your protocol that includes all the data in one bigger message…

Dear Damian,

We are trying to send colours of 500 LEDs through OSC. Ideally a frame of 500 LEDs could fit in a bundle. Then the whole bundle could be sent at once. When we try to send individual messages the number of frames per second will not even reach 25. With bundles I can send more than 200 frames per second over the ethernet link.

Possible causes: processing overhead (lots of UDP messages), ethernet frame overhead and ethernet collisions.

So the implementation of bundles would be a useful feature


right on.

well, on another thread there was a question about initialisation of the host name with a const char* vs with a string. i’m on a train for 6 hours tomorrow, but i haven’t decided if i’m taking my laptop; so there just might be a new ofxOsc with this and with bundle support by the end of the weekend :slight_smile:

if not then, by the end of next week.

will keep you posted…

Hi guys, I may be confusing the terminology here… but can you not send one message with all 500 ints?

	ofxOscMessage message;  
	for(int i=0; i<500; i++) {  
		int color = colors[i].b + (colors[i].g <<8) + (colors[i].r << 16);  

I’m doing something similar (albeit on a smaller scale), and works fine… is there a max limit on message size

** Edit **
I know thats technically not a bundle (which is one message which contains multiple messages if I understand correctly), but I was wondering if you could send all the info in one message…

i’ve updated ofxOsc - please download it and let me know if it works…