Advertisement
toko214

LoginServer.java

Nov 21st, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. public static final void run_startup_configurations() {
  2.         System.out.print("Loading Login Server...");
  3.         userLimit = ServerConfig.userLimit;
  4.         serverName = ServerConfig.serverName;
  5.         eventMessage = ServerConfig.eventMessage;
  6.         flag = ServerConfig.flag;
  7.         adminOnly = ServerConfig.adminOnly;
  8.         maxCharacters = ServerConfig.maxCharacters;
  9.  
  10.         ByteBuffer.setUseDirectBuffers(false);
  11.         ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
  12.  
  13.         acceptor = new SocketAcceptor();
  14.         final SocketAcceptorConfig cfg = new SocketAcceptorConfig();
  15.         cfg.getSessionConfig().setTcpNoDelay(true);
  16.         cfg.setDisconnectOnUnbind(true);
  17.         cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
  18.  
  19.         try {
  20.             InetSocketadd = new InetSocketAddress(PORT);
  21.             System.out.println("login: " + InetSocketadd.getAddress());
  22.             acceptor.bind(InetSocketadd, new MapleServerHandler(), cfg);
  23.             System.out.println(" Complete!");
  24.             System.out.println("Login Server is listening on port " + PORT + ".");
  25.         } catch (IOException e) {
  26.             System.out.println(" Failed!");
  27.             System.err.println("Could not bind to port " + PORT + ": " + e);
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement