Package com.esotericsoftware.kryonet.examples.chat

Source Code of com.esotericsoftware.kryonet.examples.chat.Network

package com.esotericsoftware.kryonet.examples.chat;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryonet.EndPoint;

// This class is a convenient place to keep things common to both the client and server.
public class Network {
  static public final int port = 54555;

  // This registers objects that are going to be sent over the network.
  static public void register (EndPoint endPoint) {
    Kryo kryo = endPoint.getKryo();
    kryo.register(RegisterName.class);
    kryo.register(String[].class);
    kryo.register(UpdateNames.class);
    kryo.register(ChatMessage.class);
  }

  static public class RegisterName {
    public String name;
  }

  static public class UpdateNames {
    public String[] names;
  }

  static public class ChatMessage {
    public String text;
  }
}
TOP

Related Classes of com.esotericsoftware.kryonet.examples.chat.Network

TOP
Copyright © 2018 www.massapi.com. 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.