Package com.esotericsoftware.kryonet

Examples of com.esotericsoftware.kryonet.Listener$ThreadedListener


                // 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.
                                ChatConnection connection = (ChatConnection)c;

                                if (object instanceof RegisterName) {
View Full Code Here


                // For consistency, the classes to be sent over the network are
                // registered by the same method for both the client and server.
                Network.register(client);

                client.addListener(new Listener() {
                        public void connected (Connection connection) {
                                RegisterName registerName = new RegisterName();
                                registerName.name = name;
                                client.sendTCP(registerName);
                        }
View Full Code Here

        // For consistency, the classes to be sent over the network are
        // registered by the same method for both the client and server.
        Network.register(client);

        client.addListener(new Listener() { //Add listener to the client
                public void connected (Connection connection) {
                        RegisterName registerName = new RegisterName();
                        registerName.name = WarTug.name; //TODO: THis needs to know the name of the player
                        client.sendTCP(registerName);
                }
View Full Code Here

        // For consistency, the classes to be sent over the network are
        // registered by the same method for both the client and server.
        Network.register(client);

        client.addListener(new Listener() { //Add listener to the client
                public void connected (Connection connection) {
                        RegisterName registerName = new RegisterName();
                        registerName.name = g.name; //TODO: THis needs to know the name of the player
                        client.sendTCP(registerName);
                }
View Full Code Here

    try {
      server.bind(54555, 54555);
    } catch (IOException e) {
      e.printStackTrace();
    }
    server.addListener(new Listener() {
      @Override
      public synchronized void received(Connection connection,
          Object object) {
        System.out.println(object);
        if (object instanceof GameCommand) {
View Full Code Here

    for (Class<?> clazz : KryoUtil.getInstance()
        .getClassesForRegistration()) {
      client.getKryo().register(clazz);
    }
    client.start();
    client.addListener(new Listener() {
      @Override
      public synchronized void received(Connection arg0, Object object) {
        if (object instanceof DataUpdate) {
          DataUpdate update = (DataUpdate) object;
          ReInjector.getInstance().reInject(update);
View Full Code Here

      }
    };

    NetworkMessages.registerBuiltInMessages(kryoServer);

    kryoServer.addListener(new Listener()
    {
      @Override
      public void received(Connection c, Object object)
      {
        NetConnection connection = (NetConnection) c;
View Full Code Here

    super(false);

    kryoClient = new Client();
    NetworkMessages.registerBuiltInMessages(kryoClient);

    kryoClient.addListener(new Listener()
    {
      @Override
      public void connected(Connection connection)
      {
        Login login = new Login();
View Full Code Here

    // Get the Player on the other end of the connection.
    // This allows the client to call methods on the server.
    player = ObjectSpace.getRemoteObject(client, Network.PLAYER, IPlayer.class);

    client.addListener(new Listener() {
      public void disconnected (Connection connection) {
        EventQueue.invokeLater(new Runnable() {
          public void run () {
            // Closing the frame calls the close listener which will stop the client's update thread.
            chatFrame.dispose();
View Full Code Here

    };

    // Register the classes that will be sent over the network.
    Network.register(server);

    server.addListener(new Listener() {
      public void disconnected (Connection connection) {
        Player player = (Player)connection;
        players.remove(player);
        if (player.name != null) {
          // Announce to everyone that someone (with a registered name) has left.
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryonet.Listener$ThreadedListener

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.