Пример #1
0
  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();
    }
  }
Пример #2
0
  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();
      }
    }
  }