Problem stablishing communication via OSC between mac and ubuntu

edited October 2016 in Library Questions

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!

Answers

  • Sorry, the ip set for ubuntu is "192.168.1.5". All seems ok but ubuntu doesn't want to receive

  • This might not solve the problem, but it is just an idea. Change myMessage.add(123); to myMessage.add(123.0); so you are sending a float or make sure you receive an integer. If this does not work, then in addition, make both ports the same for Rx and Tx.

    Kf

  • Hi, Kfrajer ! Interesting, because with the changes that you've proposed, ubuntu is receiving perfectly, and mac has stopped doing it. I'm near of the solution. I'll post it when It's done.

  • No way, I don't find a way to connect both. In any of cases is only one of the computers who accepts osc messages from the other. The same when I PING. It's always one of them that fails. Anyone knows a good tutorial?

Sign In or Register to comment.