public void run() {
    while (true) {
      try { // client.handle(streamIn.readUTF());
        // accept Serializable object
        Communication comm_temp = (Communication) streamInObject.readObject();

        client.handle(comm_temp.getMessage(), comm_temp.getProperty());
      } catch (IOException ioe) {
        System.out.println("Listening error: " + ioe.getMessage());
        client.stop();
      } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
  public void open() {
    try {
      streamIn = new DataInputStream(socket.getInputStream());
      streamInObject = new ObjectInputStream(socket.getInputStream());

    } catch (IOException ioe) {
      System.out.println("Error getting input stream: " + ioe);
      client.stop();
    }
  }
Esempio n. 3
0
 public static void main(String[] args) {
   ChatClient window = new ChatClient();
   window.setSize(800, 600);
   window.setVisible(true);
 }