How to reconnect/stop OscP5 TCPIP ?

edited November 3 in Library Questions

Hello, i want to stop and start new connection, but oscP5tcpClient.stop(); not working...

CLIENT

 import oscP5.*;
 OscP5 oscP5tcpClient;
 OscMessage m;

 String input;

 void setup() {
   size(500, 500);
   oscP5tcpClient = new OscP5(this, "localhost", 29922, OscP5.TCP);
   send("HELLO");
   reconnect();
 }

 void draw() {
 }

 void mouseReleased() {
   reconnect();
 }

 void reconnect() {
   oscP5tcpClient.stop();
   println("STOPPED");
   oscP5tcpClient = new OscP5(this, "localhost", 29922, OscP5.TCP);
   send("HELLO");
 }

 void oscEvent(OscMessage theMessage) {
   input = theMessage.addrPattern();
 }

 void send(String message) {
   oscP5tcpClient.send(message, new Object[] {new Integer(1)});
 }

SERVER

 import oscP5.*;
 import netP5.*;
 OscP5 oscP5tcpServer;
 NetAddress myServerAddress;

 String input;

 void setup() {
   oscP5tcpServer = new OscP5(this, 29922, OscP5.TCP);
 }

 void oscEvent(OscMessage theMessage) {
   input = theMessage.addrPattern();
   println(input);
 }
Tagged:

Answers

  • There is a new forum

    Please ask there

  • Please make sure you tell us what is the purpose of this task. It really helps to provide better feedback. See you in the new forum.

    Kf

Sign In or Register to comment.