oscP5 TCPIP stop in client cant disconnect from server

Hello, i want to stop and start new connection, but oscP5tcpClient.stop(); not working…
Can i somehow disconnect from the server ? and create new connection ?

CLIENT

import oscP5.*;
OscP5 oscP5tcpClient;
OscMessage m;
 
String input;
 
void setup() {
  size(500, 500);
  oscP5tcpClient = new OscP5(this, "localhost", 29922, OscP5.TCP);
  send("HELLO");
}
 
void draw() {
}

void mouseReleased() {
  reconnect();
}
 
void reconnect() {
  oscP5tcpClient.stop(); // <--- NOT WORKING !!!
  println("STOPPED");
  oscP5tcpClient = new OscP5(this, "localhost", 29922, OscP5.TCP);
  send("HELLO");
}

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); 
}

Here it is… the server console, it only create new connection, doesnt stop the last connection … :confused:
ERRORO

1 Like

now its works !!! just replace:

oscP5tcpClient.stop();

to:

oscP5tcpClient.tcpClient().dispose();

:slight_smile: thx

2 Likes