/** * oscP5multicast by andreas schlegel * example shows how to send osc via a multicast socket. * what is a multicast? http://en.wikipedia.org/wiki/Multicast * ip multicast ranges and uses: * 224.0.0.0 - 224.0.0.255 Reserved for special Òwell-knownÓ multicast addresses. * 224.0.1.0 - 238.255.255.255 Globally-scoped (Internet-wide) multicast addresses. * 239.0.0.0 - 239.255.255.255 Administratively-scoped (local) multicast addresses. * oscP5 website at http://www.sojamo.de/oscP5 */ import oscP5.*; import netP5.*; OscP5 oscP5; void setup() { size(400,400); frameRate(25); /* create a new instance of oscP5 using a multicast socket. */ oscP5 = new OscP5(this,"239.0.0.1",7777); } void draw() { background(0); } void mousePressed() { /* create a new OscMessage with an address pattern, in this case /test. */ OscMessage myOscMessage = new OscMessage("/test"); /* add a value (an integer) to the OscMessage */ myOscMessage.add(100); /* send the OscMessage to the multicast group. * the multicast group netAddress is the default netAddress, therefore * you dont need to specify a NetAddress to send the osc message. */ oscP5.send(myOscMessage); } /* incoming osc message are forwarded to the oscEvent method. */ void oscEvent(OscMessage theOscMessage) { /* print the address pattern and the typetag of the received OscMessage */ print("### received an osc message."); print(" addrpattern: "+theOscMessage.addrPattern()); println(" typetag: "+theOscMessage.typetag()); }