Package com.esotericsoftware.kryonet

Examples of com.esotericsoftware.kryonet.Client


      }
    });

    // ----

    Client client = new Client();
    register(client.getKryo());
    startEndPoint(client);
    client.addListener(new Listener() {
      public void received (Connection connection, Object object) {
        if (object instanceof SomeData) {
          SomeData data = (SomeData)object;
          System.out.println(data.stuff[3]);
        } else if (object instanceof SomeOtherData) {
          SomeOtherData otherData = (SomeOtherData)object;
          System.out.println(otherData.data.stuff[3]);
          assertEquals(127, data.stuff[3]);
          stopEndPoints();
        }
      }
    });
    client.connect(5000, host, tcpPort, udpPort);

    waitForThreads();
  }
View Full Code Here


      }
    });

    // ----

    final Client client = new Client();
    register(client.getKryo());
    startEndPoint(client);
    client.addListener(new Listener() {
      public void received (Connection connection, Object object) {
        if (object instanceof SomeData) {
          SomeData data = (SomeData)object;
          System.out.println(data.stuff[3]);
        } else if (object instanceof ArrayList) {
          stopEndPoints();
        }
      }
    });
    client.connect(5000, host, tcpPort, udpPort);

    waitForThreads();
  }
View Full Code Here

      }
    });

    // ----

    Client client = new Client();
    register(client.getKryo());

    ObjectSpace clientObjectSpace = new ObjectSpace(client);
    final TestObjectImpl clientTestObject = new TestObjectImpl(1234);
    clientObjectSpace.register((short)12, clientTestObject);

    startEndPoint(client);
    client.addListener(new Listener() {
      public void connected (final Connection connection) {
        RmiTest.runTest(connection, 42, 4321);
      }

      public void received (Connection connection, Object object) {
        if (!(object instanceof MessageWithTestObject)) return;
        MessageWithTestObject m = (MessageWithTestObject)object;
        System.out.println(clientTestObject.value);
        System.out.println(((TestObjectImpl)m.testObject).value);
        assertEquals(1234f, m.testObject.other());
        stopEndPoints(2000);
      }
    });
    client.connect(5000, host, tcpPort);

    waitForThreads();
  }
View Full Code Here

  UI ui;
  Client client;
  String name;

  public PositionClient () {
    client = new Client();
    client.start();

    // 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);
View Full Code Here

public class ChatClient {
  ChatFrame chatFrame;
  Client client;

  public ChatClient () {
    client = new Client();
    client.start();

    // 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);
View Full Code Here

  ChatFrame chatFrame;
  Client client;
  IPlayer player;

  public ChatRmiClient () {
    client = new Client();
    client.start();

    // Register the classes that will be sent over the network.
    Network.register(client);
View Full Code Here

      public void handle(Connection connection) {
      }
    });


    client = new Client();
    Kryo kryo = client.getKryo();
    registerKryo(kryo);
   
    client.addListener(networkListener);
   
View Full Code Here

        ChatFrame chatFrame;
        Client client;
        String name;

        public ChatClient () {
                client = new Client();
                client.start();

                // 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);
View Full Code Here

        System.exit(-1);
      }
  }
 
  private void makeClient(String host) {
    client = new Client();
        client.start();

        // 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);
View Full Code Here

      }
  }
 
  private void makeClient(String host, WarTug game) {
    final WarTug g = game;
    client = new Client();
        client.start();

        // 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);
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryonet.Client

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.