Package MultiNetworkingBase.Network

Examples of MultiNetworkingBase.Network.WarTugConnection


      //Set-up Server here
      server = new Server() {
            protected Connection newConnection () {
                    // By providing our own connection implementation, we can store per
                    // connection state without a connection ID to state look up.
                    return new WarTugConnection();
            }
      };
     
      // For consistency, the classes to be sent over the network are
        // registered by the same method for both the client and server.
        Network.register(server);
       
        server.addListener(new Listener() {
            public void received (Connection c, Object object) {
                // We know all connections for this server are actually ChatConnections.
              WarTugConnection connection = (WarTugConnection)c;

                if (object instanceof RegisterName) {
                  if (numPlayers==2) return; //Only let two players on server
                    if (connection.name != null) return; // Ignore the object if the name is invalid.
                    String name = ((RegisterName)object).name;
View Full Code Here

TOP

Related Classes of MultiNetworkingBase.Network.WarTugConnection

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.