Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is currently no such concept implemented in oscP5. Here is a similar <a href="https://stackoverflow.com/questions/5566285/processing-oscp5-library">discussion</a>.</p> <p>Seems like you have to build something yourself based on the memory address found in the debug info, e.g. <code>### new Client @ netP5.TcpClient@164b9b6</code>. I scan the System.out stream for the string <code>new Client</code> and call the method <code>clientConnected</code> then. This is totally hacky, but I currently don’t see another way.</p> <pre><code>import java.io.PrintStream; import oscP5.*; import netP5.*; OscP5 oscP5tcpServer; OscP5 oscP5tcpClient; NetAddress myServerAddress; void setup() { // overwrite standard System.out System.setOut(new PrintStream(System.out) { public void println(String s) { if(s.indexOf("new Client") != -1){ clientConnected(getMemoryAddress(s)); } super.println(s); } // override some other methods? }); oscP5tcpServer = new OscP5(this, 11000, OscP5.TCP); oscP5tcpClient = new OscP5(this, "127.0.0.1", 11000, OscP5.TCP); } void clientConnected(int memoryAddress){ println("Client connected, with memory address " + memoryAddress); } int getMemoryAddress(String s){ return Integer.parseInt(s.substring(s.lastIndexOf('@')+1), 16); } void draw() { } void mousePressed() { oscP5tcpClient.send("/test", new Object[] {new Integer(1)}); } void keyPressed() { println(oscP5tcpServer.tcpServer().getClients().length); } void oscEvent(OscMessage theMessage) { System.out.println("### got a message " + theMessage); if(theMessage.checkAddrPattern("/test")) { OscMessage m = new OscMessage("/response"); m.add("server response: got it"); oscP5tcpServer.send(m,theMessage.tcpConnection()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload