Example #1
0
 /** Listens for client requests until stopped. */
 public void run() {
   try {
     while (listener != null) {
       try {
         Socket socket = serverSocket.accept();
         if (!paranoid || checkSocket(socket)) {
           Runner runner = getRunner();
           runner.handle(socket);
           // new Connection (socket);
         } else socket.close();
       } catch (Exception ex) {
         System.err.println("Exception in XML-RPC listener loop (" + ex + ").");
       } catch (Error err) {
         System.err.println("Error in XML-RPC listener loop (" + err + ").");
       }
     }
   } catch (Exception exception) {
     System.err.println("Error accepting XML-RPC connections (" + exception + ").");
   } finally {
     System.err.println("Closing XML-RPC server socket.");
     try {
       serverSocket.close();
       serverSocket = null;
     } catch (IOException ignore) {
     }
   }
 }