Пример #1
0
  public static void main(String[] args) {
    // Establecimiento del game en el rmiserver
    if (args.length == 0) {
      System.out.println("Wrong number of argument");
      System.exit(1);
    }

    listAddr = new ListAddr();
    serverInfo = listAddr.getServer(args[args.length - 1]);
    serverName = args[args.length - 1];

    if (args.length == 2 && args[0].equals("wait")) {
      try {
        serverWaiting();
      } catch (Exception e) {
        System.out.println("Failed to wait");
      }
    } else {
      if (args.length == 2) numPlayer = Integer.parseInt(args[0]);
      serverInit();

      File file = new File(serverName + ".swp");
      if (file.exists()) {
        try {
          InputStream ips = new FileInputStream(serverName + ".swp");
          InputStreamReader ipsr = new InputStreamReader(ips);
          BufferedReader br = new BufferedReader(ipsr);
          String info = br.readLine();
          reconstruction(info);
        } catch (FileNotFoundException e) {
          System.out.println("Failed to wait");
        } catch (IOException e) {
          System.out.println("Failed to wait");
        }
      }
      saveStateServer();
      serverRunning();
    }
  }
Пример #2
0
  public static void main(String[] args) {
    // Establecimiento del game en el rmiserver
    if (args.length == 0) {
      System.out.println("Wrong number of argument");
      System.exit(1);
    }

    listAddr = new ListAddr();
    serverInfo = listAddr.getServer(args[args.length - 1]);
    serverName = args[args.length - 1];

    if (args.length == 2 && args[0].equals("wait")) {
      try {
        serverWaiting();
      } catch (Exception e) {
        System.out.println("Failed to wait");
      }
    } else {
      if (args.length == 2) numPlayer = Integer.parseInt(args[0]);
      recuperacionFallas();
      serverRunning();
    }
  }