We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › clientEvents() error
Page Index Toggle Pages: 1
clientEvents() error (Read 252 times)
clientEvents() error
Mar 4th, 2008, 10:02pm
 
when I try to use a client event with a server, I constantly get an error:

"error, disabling clientEvent() for 127.0.0.1
java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(native method)"

I have no idea why this happens

here is my code in short:

import processing.net.*;
Client myClient;
int dataIn;

void setup() {
 size(200, 200);
 // Connect to the local machine at port 5204.
 // This example will not run if you haven't
 // previously started a server on this port
 myClient = new Client(this, "127.0.0.1", 5204);
}

void draw() {
 /*
 if (myClient.available() > 0) {
   //println(myClient.read());
   dataIn = myClient.read();
 }
 background(dataIn);
 */
}

void clientEvent(Client someClient) {
 print("Server Says:  ");
 dataIn = myClient.read();
 println(dataIn);
 background(dataIn);
}
Page Index Toggle Pages: 1