Package com.golden.gamedev.engine

Examples of com.golden.gamedev.engine.BaseClient


    // we need to register our custom packet first
    NetworkConfig.registerPacket((short) 1, AllFieldTypePacket.class);
    NetworkConfig.DEBUG = true;
   
    try {
      BaseClient bsClient = new TCPClient(host, port); // create client
                                // and connect
                                // to server
     
      int sendCounter = 0;
     
      System.out.println("Start the Client...");
     
      // network loop
      while (true) {
        bsClient.update(100); // the main work
       
        // send packet to server
        // every 50 tick
        if (++sendCounter % 50 == 0) {
          bsClient.sendPacket(new AllFieldTypePacket());
        }
       
        // disconnect from server
        // after 200 tick
        if (sendCounter > 200) {
          bsClient.silentDisconnect();
          break;
        }
       
        try {
          Thread.sleep(100);
View Full Code Here

TOP

Related Classes of com.golden.gamedev.engine.BaseClient

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.