Getting UDP multicasting to work

Hi all,

I’m writing a fairly simple application where one app sends some timecode data to another via UDP. This is easy when there is 1 “sender” and 1 “receiver”, but I can’t seem to get multiple receivers to work (always throws exception about the “given addr already in use” when trying to bind to the UDP host/post).

I’m pretty sure multicasting is the answer, but I can’t get this to work either!

My “sender” application does the following:

updConnection.ConnectMcast("", 50000);  

And my “receiver” application does the following:


But then I always get the error message:

OF_ERROR: ofxNetwork:/Users/stephen/Desktop/hackinect/of_preRelease_v0062_osxSL_FAT/apps/mine/ygboX-slave/…/…/…/addons/ofxNetwork/src/ofxUDPManager.cpp: 98 EADDRINUSE: the socket address of the given addr is already in use

Am I using connectMCast and BindMCast correctly? Do I have the right IP addresses here?

those addresses that you are using are for broadcasting, not multicasting, (you probably want broadcasting if you are in a local network)

so just call:


and use the normal connection and binding methods.

Great! And this will work if the “sender” and “client” applications are all on the same host?

it should, if you have problems binding, try using the SetReuseAddress method

And these features work in OF 062?

yes, that has not been changed for 007 as far as i remember

And what about multicasting using OSC? Does that work similarly now?

there’s no way of setting multicasting or broadcasting in oscpack the library that ofxOsc uses, so no unless you hack the library you want be able to use it.