Ejemplo n.º 1
0
 public void initializeStreams() throws IOException {
   System.out.println("ThreadWorker# initialize start");
   writer = new ObjectOutputStream((socket.getOutputStream()));
   writer.flush();
   reader = new ObjectInputStream(new BufferedInputStream(socket.getInputStream()));
   System.out.println("ThreadWorker# initialize success");
 }
Ejemplo n.º 2
0
 public void sendMessage(ObjectExchange data) throws IOException {
   synchronized (this) {
     if (writer != null && !socket.isClosed()) {
       //  data.friend_id  =   transactionId;
       writer.writeObject(data);
       writer.flush();
     }
   }
 }