Einzelnen Beitrag anzeigen
Alt 25.04.2003, 13:23   #10
blauesau
Hero
 
Registriert seit: 08.04.2003
Beiträge: 821


Standard

Die Methode run() vom Server-Thread:

Code:
public void run() {
    InputStream input = null;
    ObjectInputStream oinput = null;

    System.out.println("(" + instance + ") Verbindung aufgebaut");

    try {
      input = socket.getInputStream();
      oinput = new ObjectInputStream(input);
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }

    JPanel o;

    Object ob = null;
    try {
      while (true) {
        if ((ob = oinput.readObject()) == null) {
          System.out.println("NULL");
          break;
        }
        else {
          System.out.println(ob.toString());
          oinput = new ObjectInputStream(input);
        }

      }

      System.out.println("(" + instance + ") Verbindung beendet");
      oinput.close();
      input.close();
      socket.close();

    }
    catch (Exception ex1) {
      ex1.printStackTrace();
      //System.out.println(ob.toString());
    }
  }
blauesau ist offline   Mit Zitat antworten