dB wrote on Sep 29th, 2008, 11:30pm:After some more playing around, my understanding now is that Client() sidesteps the complexity of exceptions altogether, at the cost of flexibility and reliability. That makes sense.
From where I'm standing, if you're doing anything more complicated than just hooking up a single client to a server (without ever disconnecting), I think you'll probably want to write your own Java classes to handle the client/server stuff.
That's correct, we hide exceptions in nearly all of the API to make this tradeoff, generally choosing another method for handling their error messages. For instance, loadImage() returns null (and prints an error message to the console) when image loading fails (rather than producing
all manner of exceptions).
But if you need more control, the Client class is about 500 lines of code, and included with the Processing download so that you can modify it for your own use. It's very simple.
And for the original poster, use client.active() to determine whether the client has failed/disconnected/whatever. No need to restart the sketch completely, or rewrite everything in Java.