//THIS IS FROM CLASS inputThread.java , it is started from main. public void run() { try { w = new Webcam(); w.start(); System.out.println("This should happen second"); //wait statement here. ADD in protocol stuff like to send to client, some sort of request pending. PrintWriter out = new PrintWriter(socket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); String inputLine, outputLine; //outputLine = cpp.processInput(null); //out.println(outputLine); while ((inputLine = in.readLine()) != null) { outputLine = w.getFrame().toString(); out.println(outputLine); //yield(); if (outputLine.equals("Bye")) break; } out.close(); in.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } //THIS IS FROM CLASS WEBCAM.java public void run() { active = true; //fetch device formats fetchDeviceFormats(); //choose format! camImgSel=0; String camS = (String)camImgSize.elementAt(camImgSel); int pos_x = camS.indexOf("x"); String widS = camS.substring(0,pos_x); String hgtS = camS.substring(pos_x+1,camS.length()); camWidth = Integer.parseInt(widS.trim()); camHeight = Integer.parseInt(hgtS.trim()); camFPS = 30; //set up data source fetchDeviceDataSource(); //Thread.yield(); //start data source createPBDSource(); //Thread.yield(); try{dataSource.start();}catch(Exception e){System.out.println("Exception dataSource.start() "+e);} //Thread.yield(); try{sleep(1000);}catch(Exception e){} // to let camera settle ahead of processing //buffer and dcm b=new Buffer(); //TODO CHECK THAT THIS IS NEEDED. DirectColorModel dcm = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF); //sets frameOF to false boolean frameOK=false; while(active==true) { //checks if still false frameOK = camFetchFrame(); if(frameOK==false) // inData is null { try{sleep(5);}catch(Exception e){} continue; } //process methods originally here. try{sleep(5);}catch(Exception e){} System.out.println("This should happen first"); yield(); } }