I am running an application that controls the pan and tilt of a webcam via a web server using two servos and an http response sketch based on Tom Igoe's sample program "A networked cat". Here is the basic http response code (minus the serial servo control and response string parsing code, for clarity):
public void draw()
{
makeHTTPCall();
// check if client has sent any bytes if request is in progress
if(requestInProgress == true){
checkNetClient();
}
}
public void makeHTTPCall()
{
// do this only if you're not already in the middle of an HTTP request
// make note that you've got a request in progress
requestInProgress = true;
}
}
void checkNetClient() { // available() returns how many bytes have been received by the client: if (client.available() > 0) { // read a byte, convert it to a character, and add it to the string: responseString +=char(client.read()); // print the response: //println(responseString); //much of the data being returned is HTTP header information
// add to a line of |'s on the screen (crude progress bar): print("|"); } // if there's no bytes available, either the response hasn't // started yet, or it's done: else { // if responseString is longer than 0 bytes, the response has started: if(responseString.length() > 0 ) { // you've got some bytes, but now there's no more to read. Stop: if(requestInProgress == true) {
// print the response: println(responseString);
// note that the request is over: requestInProgress = false;
// reset the string for future requests: responseString = "";
} } } }
My problem is the javaw.exe process, which ramps up to 100% CPU after about an hour of running the application under XP sp3 with JRE 6. I have searched numerous forums which have identified a similar problem with javaw.exe running different java applications, but haven't found a solution! Anyone else experiencing this or know of any workarounds?