iPad/iPhone/Android communication and ofxOSC

I’m trying to have iPad/iPhone (and later android) communicate to each-other. Is there an ideal way to have each device be both a client/server so they can send data back and forth?

I’m not sure if OSC is ideal, but I’m experimenting with it with little luck.

I can’t get the ofxOSC Sender/Receiver examples working on iPhone/iPad. I tried sending to localhost on port 12345 on the iPad and have the iPhone receive on port 12345. However, I can’t get the receiver to receive anything. If I try to send to my computer (instead of the iPhone), I also get nothing. After changing the IP to the IPV4 address that ipconfig shows, I was able to send to my computer, but the iPhone still doesn’t receive.

Is there a way to auto-detect the IPAddress that the devices are on so they can automatically send to that address? Does anyone have the ofxOSC receive working on an iOS device? I’ve tried sending OSC from MAX/MSP and the receive doesn’t receive that either.

I have recently encountered a bug which exhibits similar behaviour to yours. http://forum.openframeworks.cc/t/ofxosc-strange-behaviourbug-using-the-examples—please-help/6918/0
maybe you go some more insight so that this bug can be fixed?
have you already tried changing the listening port to something else and back again? this has consistently fixed the issue for me.

btw as is understand it, if you send to localhost on the ipad, you shouldn’t receive anything on another device, anyway - localhost is the app’s own device. you have to enter the ip of the target device.

Thanks for the response.

I tried putting receiver.setup(9000); //wrong port in setup


receiver.setup(12345); // right port on double tap

So that it switches to the right one after it starts. Is that what you meant to try?

This didn’t do anything though. Right now I’m testing by sending OSC out from MAX/MSP to port 12345 (I’ve tried other ports with the no response). I’m not sure if I’m sending to the wrong IP though. How do I know which IP to send out to so that the iPhone/iPad will listen?

Ok, I just tried sending broadcast to and it worked to receive. That is without having to toggle the port.

Now the problem is ofxOSC Sender doesn’t broadcast to It appears that was talked about here: http://forum.openframeworks.cc/t/broadcasting-with-ofxosc/1625/0 =\

Well, I was able to get things somewhat working with a 1-way communication after following some of the directions here for broadcasting: http://forum.openframeworks.cc/t/broadcasting-with-ofxosc/1625/1

The iPad is running the ofxOSC Receiver example and the iPhone running the Sender example:


However, the receiver is dropping/not-receiving data. I know it’s being sent because I can send the OSC to my computer and MAX/MSP will print it out correctly and very fast. I tried the receiver on both my iphone and ipad and both are dropping (so it doesn’t seem to be a cpu issue).

yes. switching is what I meant to try.
you should probably find the ipad/pod’s IP somewhere in the wireless settings.

strange about the dropouts. is it possible that the network is overloaded? (ofxosc is sending via UDP, which just fire-and-forgets packets, to there’s no confirmation that it reached the receivin IP). or are you saying that it works with max as expected, without problems?

When the sender sends to a computer and received through MAX/MSP, it receives all the packets. So, I know the sender is working.

The receiver however is not receiving all the packets. I don’t think it’s a network overload since I’m only sending a touch event 1 time per second. Sometimes it gets the message and sometimes it doesn’t.

Instead of only sending the up/down event when they happen, I tried continually sending a ‘down’ event when finger touched and then continually an ‘up’ event when released. This had a similar effect. It was dropping messages and delayed significantly. MAX/MSP however was still reading in the messages very fast and accurately so the sender is correct.

So, something is wrong with the receiver either not polling fast enough so that messages sent between it’s polling aren’t coming in. Or something else I can’t figure out.

have you also tried the other way round (send with max/msp, receive with the of receiver) to exclude some sender weirdness?

Good question. Yeah, I’ve also sent from MAX to the iPad or iPhone receiver and it still drops messages. It seems maybe it is a CPU thing. My iPhone is a first gen (so not as fast) and my iPad is an iPad2. The iPad2 seems to be receiving 90% and the iphone maybe 75%. I’ll stick a FPS print out in the apps to see if they’re slow or not.

hm, strange. sorry i can’t help here. something certainly is fishy with ofxosc these days, as evidenced by my other bug (which I suspect to be in the receiver side, too).

Yeah it’s really odd. I put in a fps printout and it’s pretty dead on 30fps which is what I set it to. So, something doesn’t seem right. At 30fps I don’t think it should be dropping messages for 1/2- 2 seconds. I’ll have to put in some trace messages maybe in oscpack itself to see what’s happening.

i think no messages should be dropped at all because they should pile up in the receiver and be processed every frame. isn’t the event thing that i think is responsible for catching the messages running in its own thread or something? I’m a bit our of my depth here…

Yeah, I think you’re right that no messages should be dropped and yes I believe it runs in its own thread. It’s very odd behavior and not very consistant. Sometimes it’ll get all the messages and very fast and other times it won’t print them at all. I’m monitoring the receiving on a main computer though and it shows all the messages are being sent. I’m not used to working so low-level so i’ll have to see if I can debug some more. I might try running the receiver example on a PC and see if the same thing happens or not.

[quote=“Seth (cerupcat), post:13, topic:7087”]I’m monitoring the receiving on a main computer though and it shows all the messages are being sent.
what are you saying here? you can successfully receive all messages on a “big” computer?
afaik, there’s no way on the sender side to determine if a message has been sent successfully, right?

Yeah, I have a computer running MAX/MSP and listening on the port that messages are being sent to. It receives all the messages just fine. So, I know the ofxOSC Sender example is correctly sending all messages. The ofxOSC receiver however is either not receiving all of the messages or they are getting lost somewhere because they don’t print when I try to print the list of messages received.

hm. i had opened that issue https://github.com/openframeworks/openFrameworks/issues/701 on github, so maybe pitch in there.

does anyone else have input on this? arturo? a good way how to debug this and get to the bottom of the problem?