Specifying network interface controller in OscP5
in
Contributed Library Questions
•
10 months ago
I am working on a piece in which data from an SQL database is being read by one laptop (via SQLibrary) and then passed on to 4 other laptops (via OscP5). We are on an ad-hoc wifi network.
I would like to use a multicast address to send the data to all laptops at the same time without collecting ip addresses, which works just fine as long as I am not connected to the internet over ethernet as well (which I need to be, in order to query the SQL database).
How can I specify that the osc messages should be sent over the ad-hoc wifi network (use the wifi card) rather than down the ethernet cable?
Here is an example of code that works to send the messages over the ad-hoc as long as ethernet is unplugged, but seems to default to the ethernet interface when that is connected:
import oscP5.*;
import netP5.*;
OscP5 oscP5;
String[] messages = {"Doug 1", "Doug 2", "Doug 3", "Doug 4", "Doug louder", "Doug softer", "Eddie 1", "Eddie 2", "Eddie 3", "Eddie 4", "Eddie louder", "Eddie softer", "Phil 1", "Phil 2", "Phil 3", "Phil 4", "Phil louder", "Phil softer", "Matt 1", "Matt 2", "Matt 3", "Matt 4", "Matt louder", "Matt softer", "All 1", "All 2", "All 3", "All 4", "All louder", "All softer"};
void setup(){
frameRate(0.5);
oscP5 = new OscP5(this, "224.0.0.1", 7777);
}
void draw(){
int selector = int(random(30));
OscMessage myMessage = new OscMessage("/bodies");
myMessage.add(messages[selector]);
oscP5.send(myMessage);
}
Thanks!
1