private void listen() {
    try {
      Socket client_socket = m_incoming_conn.accept();
      //client_socket.setKeepAlive(true);
      System.out.println("Received connection request");

      ObjectInputStream is = new ObjectInputStream(
          client_socket.getInputStream());
      
      System.out.println("Reading object ...");
      Object o = is.readObject();
      System.out.println("Object readed.");
      
      String name = new String();
      boolean accepted = false;

      // Check message type
      if (o instanceof Join) {
        Join msg = (Join) o;
        name = msg.getName();

        if (addUser(msg.getName())) {
          System.out.println("Added user in user pool.");
          accepted = true;
        } else {
          System.out.println("Username '" + name + "' currently in use.");
        }
      }
      if (o instanceof Send) {
        // Reply in multicast group
        Send msg = (Send) o;
        System.out.println("Received Send message (" + msg.getName() + ", "
            + msg.getMessage() + ") ..");
        multicast(msg);
        System.out.println("Broadcasted message.");
      }
      if(o instanceof Leave){
    	  Leave msg = (Leave)o;
    	  name = msg.getName();
    	  boolean removed = m_user_list.remove(name);
    	  if(removed==true) System.out.println("User removed");
    	  else System.out.println("User not removed.");
    	  multicast(msg);
      }

      if (accepted) {
        ObjectOutputStream os = new ObjectOutputStream(
            client_socket.getOutputStream());
        Join msg = new Join(name, accepted);
        os.writeObject(msg);
        os.flush();
        multicast(msg);
      }

      client_socket.close();

    } catch (IOException e) {
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
  }