/* Auteur: Nicolas JANEY, nico@univ-fcomte.fr */

import java.awt.* ;
import java.net.* ;
import java.io.* ;

public class ThreadBrasRobot extends Thread {
  private BrasRobot e6 ;

  public ThreadBrasRobot(BrasRobot e) {
    e6 = e ;
    }

  public void run() {
    boolean bRun = true ;
    while ( bRun) {
      Socket s ;
      int port = 5556 ;
      try {
        s = new Socket(e6.host,port) ;
        InputStream is = s.getInputStream() ;
        DataInputStream ois = new DataInputStream(is) ;
        int a1 = ois.readInt() ;
        int a2 = ois.readInt() ;
        int a3 = ois.readInt() ;
        e6.miseAJour(a1,a2,a3) ;
        System.out.println(a1+" : "+a2+" : "+a3) ;
        ois.close() ; }
      catch (UnknownHostException uhe) {
        bRun = false ; } 
      catch (IOException ioe) {
        bRun = false ; } ;
      try {
        sleep(100) ; }
      catch (Exception e) { } ; }
    } 
  }
