[PD] Receiving OSC on Java

Hugo Solis Garcia hugosg at media.mit.edu
Wed Feb 4 00:28:27 CET 2004

After the Chandrasehar R. response I decide to try a little bite more.
I still unable to receive OSC with the new version posted on December
My testing implementation is really simple, if you have some minutes I
really apreciate your help! Thanks!

This is my code in Java:

import com.illposed.osc.*;
import java.net.*;

public class OSCReceiverSimple01 extends java.applet.Applet implements
OSCListener {
    OSCPort myOSCPort;
    public void init() {
        try {
            myOSCPort = new OSCPort(InetAddress.getLocalHost(), 8989);
            myOSCPort.addListener("/pureData", this);
        } catch (Exception e) {
    public void acceptMessage(java.util.Date date,
com.illposed.osc.OSCMessage oSCMessage) {
        System.out.println("I get something");

In PD I have an Object SendOSC, I send to it the message "connect
localhost 8989" and I get the message
connected to port localhost:8082 (hSock=144348816)
then I send to the SendOSC the message "send /pureData 1" 
I don't get nada in the Java side???
I've been trying with more complex situations. For example adding a
main in the applet and running it as single executable just in case it
was a problem with conection permitions, however nothing happens. I
also try creating a independent class for the listener as the example
of Donald R. Tognazzini suggest (see later). However I get the same

    class MyOSCResponder implements OSCListener
        public MyOSCResponder( )

        public void acceptMessage( Date time, OSCMessage message )
            System.out.println( "Received OSC Message:\n" +
                                "Time    : "  + time + "\n" +
                                "Message : " + message );

    // create the responder
    MyOSCResponder myResponder = new MyOSCResponder( );

    // register to receive "/done" messages
    someOSCPort.addListener( "/done", myResponder );

    // register to receive "/n_end" messages
    someOSCPort.addListener( "/n_end", myResponder );

Maybe someone know what is wrong, maybe there is a bug, maybe I'm
forgeting something simple. I didn't try the IIRC solution that Martin
Rumori suggest since it involves more elements (thanks Martin anyway!)
Just in case it could affect, I'm using Fedora system, PD version 1.37
Thanks alot!

More information about the Pd-list mailing list