Package com.golden.gamedev.engine.network.tcp

Examples of com.golden.gamedev.engine.network.tcp.TCPServer


    }
  }
 
  public static void main(String[] args) {
    // construct server
    TCPServer server = null;
   
    try {
      server = new TCPServer(11137); // connect to port 11137
     
    }
    catch (IOException ex) {
      ex.printStackTrace();
      System.err.println("Server initialization failed.\nCaused by:\n"
              + ex.getMessage());
      System.exit(-1);
    }
   
    System.out.println("Server Detail: " + server.getDetail());
   
    // network loop
    while (true) {
      try {
        server.update(100);
       
      }
      catch (IOException ex) {
        ex.printStackTrace();
      }
View Full Code Here


      ex.printStackTrace();
      System.exit(-1);
    }
   
    // create the server
    TCPServer server = null;
    try {
      server = new TCPServer(portNumber);
      // server.setMaxClients(2);
     
    }
    catch (IOException ex) {
      ex.printStackTrace();
View Full Code Here

    // we need to register our custom packet first
    NetworkConfig.registerPacket((short) 1, AllFieldTypePacket.class);
    NetworkConfig.DEBUG = true;
   
    try {
      BaseServer bsServer = new TCPServer(port); // create the server
     
      System.out.println("Waiting for clients...");
     
      // network loop
      while (true) {
        bsServer.update(100); // the main work
       
        // iterate all received packets
        BaseClient[] clients = bsServer.getReceivedPacketClients();
        for (int i = 0; i < clients.length; i++) {
          NetworkPacket[] packets = clients[i].getReceivedPackets();
         
          // simply send back message OK
          clients[i]
View Full Code Here

TOP

Related Classes of com.golden.gamedev.engine.network.tcp.TCPServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.