I know this has been an issue for others too, but was wondering if anyone found a solution.
I’d like to broadcast OSC Messages to my local subnet, and usually with UDP this happens by sending the message to FF.FF.FF.FF or keeping the subnet mask and setting all the bits (e.g. 192.168.0.FF if subnet is 192.168.0 and mask is FF.FF.FF.0). This also works when sending with OSC - except when using oscPack, and unfortunately ofxOsc is built on oscPack so doesn’t work. Does anyone know what the best solution to this is? (even if it is a hack for now).
Hey Arturo, unfortunately couldn’t get it to work (1st param I think is socket_ instead of socket for it to compile btw.). I’m trying on iPhone so that may have something to do with it. ofxOsc works perfectly on iPhone - (which I was a bit surprised to be honest to be able to use the normal libOsc.a! Do you not need iphone specific libs?) but broadcasting doesn’t. Maybe its not supported on iPhone?
I can get the broadcasting/multicasting to work using the changes above. But as soon as more than one client application on the same local host tries to “listen in”, it gets rejected with a “unable to bind udp socket” error.
Kyle, Memo, what’s the current status of this in 007? Did those options get incorporated into oscpack, and are they in ofxOsc in 007? It seems at least address reuse is not implemented, that doesn’t work with stock ofxOsc for me. Is this endianness-fix for 64bit still necessary in 007?
Thanks Arturo, but I couldn’t figure out how to recompile it. I changed the things it said in the makefile for OSX and ran ‘make’ and ‘make lib’ but it doesn’t create the .a. I don’t use make enough to know what I’m doing heh.
edit: I wasn’t able to compile it as a seperate lib .a, but I was able to compile it as part of the project I’m using instead by including the source. So, that works for now. It still doesn’t work with 255.255.255.255 though (anyone have that working?), but it does work with 192.168.1.255 which it didn’t before.
yes actually 255.255.255.255 is not the broadcast address. you can get the broadcast address by doing an binary or of the ip address and the negated subnet mask. so if your address is 192.168.1.xxx and your subnet mask 255.255.255.0:
192.168.1.xxx | 0.0.0.255 = 192.168.1.255
255.255.255.255 is the broadcast address for the local network and though it should work it doesn’t for some systems like the iphone
Ah ok thanks. I guess the problem is, what if you want devices to connect to each other without having to manually input an IP. Is there a way for them to auto discover the broadcast IP? Does oscpack have a getIP function? I couldn’t find it.
there’s also this thing called libmapper, which adds another layer to OSC, so to say, to add things like autodiscover, mapping of messages, etc.
I think it could be worthwhile to get this over to oF, there’s even a guy who began ofxlibmapper, but i don’t have the time and skills for that. I want(ed) to build something like osculator, just crossplatform and opensource, with it. https://github.com/radarsat1/libmapper