JAVA Tuio client, Exception after disconnect
Posted: 16 December 2010 10:07 AM   [ Ignore ]
Avatar
Rank
Joined  2009-09-25
Total Posts:  67
New Member

Hey,
I’m having some trouble with a TUIO client programmed in JAVA.
Its a program that runs in fullsreen mode, lets say it visualises the touch points, if the user presses ESC the program leaves fullscreen mode.
What I do after the user presses ESC is to close the port and remove all listeners.

Looks like this:

public void closeClient (){

System.out.println("Closing Clients");
this.client.disconnect();
this.client.removeAllTuioListeners();
}

What I get is an Exception:

Closing Clients
java.net.SocketException: socket closed
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.PlainDatagramSocketImpl.receive(Unknown Source)
at java.net.DatagramSocket.receive(Unknown Source)
at com.illposed.osc.OSCPortIn.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

...and I really do not know why. If I don’t disconnect the client (client.disconnect()), the Exc does not appear but the port is still blocked.

There might be someone who knows how to fix this?

Thanks!

Cheers,
Tobi

 Signature 

http://www.prime-touch.com
http://www.radar-touch.com

Profile
 
 
Posted: 25 February 2011 09:28 AM   [ Ignore ]   [ # 1 ]
Avatar
Rank
Joined  2009-09-25
Total Posts:  67
New Member

Hey,
really strange… I tried to figure out where this exception came from. It was happening while TUIOClient calls disconnect()

public void disconnect() {
oscPort.stopListening();

try { Thread.sleep(500); }
catch (Exception e) {}
oscPort.close();
connected = false;
}

The Excetption came from OSCPortIn close() :

public void close() {
socket.close();
}

I wanted to know what happened in detail so I implemented the source code from TUIO Java and the OSC src code.
After doing this and checking if it works: No exception aynmore!

I dont know why… really strange.

Cheers,
Tobi

 Signature 

http://www.prime-touch.com
http://www.radar-touch.com

Profile