Hi, all,
I’m trying to communicate with oscp5 via ethernet, with a simple example, between mac and ubuntu. As mac is receiving, not the same with ubuntu. I’m pretty new with ubuntu but, first of all i’ve set the ip for the ubuntu:
sudo ifconfig enp8s0 192.168.1.6 netmask 255.255.255.0
(As enp8s0 is the ethernet id )
My ip on the mac is 192.168.1.3
And here are the codes:
In ubuntu:
/**
* oscP5sendreceive by andreas schlegel
* example shows how to send and receive osc messages.
* oscP5 website at http://www.sojamo.de/oscP5
*/
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
String ipMac="192.168.1.3";
String ipUb="192.168.1.5";
int macPort = 12000;
int ubPort=57120;
void setup() {
size(400,400);
frameRate(25);
oscP5 = new OscP5(this,macPort);
myRemoteLocation = new NetAddress(ipMac,ubPort);
}
void draw() {
background(0);
}
void mousePressed() {
OscMessage myMessage = new OscMessage("/test");
myMessage.add(123);
oscP5.send(myMessage, myRemoteLocation);
}
void oscEvent(OscMessage theOscMessage) {
print("### received an osc message.");
print(" addrpattern: "+theOscMessage.addrPattern());
println(" typetag: "+theOscMessage.typetag());
}
In mac:
/**
* oscP5sendreceive by andreas schlegel
* example shows how to send and receive osc messages.
* oscP5 website at http://www.sojamo.de/oscP5
*/
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
String ipMac="192.168.1.3";
String ipUb="192.168.1.5";
int macPort = 12000;
int ubPort=57120;
void setup() {
size(400,400);
frameRate(25);
oscP5 = new OscP5(this,ubPort);
myRemoteLocation = new NetAddress(ipUb,macPort);
}
void draw() {
background(0);
}
void mousePressed() {
OscMessage myMessage = new OscMessage("/test");
myMessage.add(123); /* add an int to the osc message */
oscP5.send(myMessage, myRemoteLocation);
}
void oscEvent(OscMessage theOscMessage) {
float value = theOscMessage.get(0).floatValue();
println(" value: "+value);
}
Any clue or advice will be very very welcome. A lot of thanks!