Advertisement
Guest User

ServerMP class

a guest
Jun 27th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. public class ServerMP {
  2.  
  3.     public static final String ip = "localhost";
  4.     public static final int tcpPort = 32000, udpPort = 32556;
  5.     private Server server;
  6.    
  7.     public ServerMP() {
  8.         server = new Server(1024 * 64, 4096);
  9.         registerPackets();
  10.        
  11.         NetworkListener nl = new NetworkListener();
  12.         server.addListener(nl);
  13.         try {
  14.             server.bind(tcpPort, udpPort);
  15.         } catch (IOException e) {
  16.             e.printStackTrace();
  17.         }
  18.         server.start();
  19.     }
  20.    
  21.     public void registerPackets() {
  22.         Kryo kryo = server.getKryo();
  23.         kryo.register(Packet00LoginRequest.class);
  24.         kryo.register(Packet01LoginAnswer.class);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement