コード例 #1
0
 public void sendFactory(Factory factory) {
   try {
     oos.writeObject(factory);
     oos.flush();
   } catch (IOException ioe) {
     Util.printExceptionToCommand(ioe);
   }
 }
コード例 #2
0
 public void sendResource(Resource resource) {
   try {
     oos.writeObject(resource);
     oos.flush();
   } catch (IOException e) {
     Util.printExceptionToCommand(e);
     e.printStackTrace();
   }
 }
コード例 #3
0
 // reading a message
 public void run() {
   try {
     String line = br.readLine();
     while (line != null) {
       FactoryServerGUI.addMessage(
           socket.getInetAddress() + ":" + socket.getPort() + " - " + line);
       line = br.readLine();
     }
   } catch (IOException ioe) {
     serverListener.removeServerClientCommunicator(this);
     FactoryServerGUI.addMessage(
         socket.getInetAddress() + ":" + socket.getPort() + " - " + Constants.clientDisconnected);
     // this means that the socket is closed since no more lines are being received
     try {
       socket.close();
     } catch (IOException ioe1) {
       Util.printExceptionToCommand(ioe1);
     }
   }
 }