Ejemplo n.º 1
0
  BattleField(int id, String url, int port, String otherUrl, int otherPort, boolean restart) {
    battlefields = new HashMap<InetSocketAddress, Integer>();
    this.url = url;
    this.port = port;
    this.id = id;
    this.restart = restart;

    battlefields.put(new InetSocketAddress(url, port), 0);
    initBattleField(restart);

    Message message = new Message();
    message.put("request", MessageRequest.requestBFList);
    message.put("bfAddress", new InetSocketAddress(url, port));
    SynchronizedClientSocket clientSocket;
    clientSocket =
        new SynchronizedClientSocket(message, new InetSocketAddress(otherUrl, otherPort), this);
    clientSocket.sendMessageWithResponse();
  }