Package com.esotericsoftware.kryonet

Examples of com.esotericsoftware.kryonet.Connection


        }
    }

    @Override
    public String getIP(Integer id) {
        Connection connection = connections.get(id);
        InetSocketAddress address = connection.getRemoteAddressTCP();
        return address != null ? address.getHostString() : "";
    }
View Full Code Here


        output.writeInt(handler.objectID, true);
      }

      public Object read (Kryo kryo, Input input, Class type) {
        int objectID = input.readInt(true);
        Connection connection = (Connection)kryo.getContext().get("connection");
        Object object = getRegisteredObject(connection, objectID);
        if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection);
        return object;
      }
    });
View Full Code Here

  /** Serializes an object registered with an ObjectSpace so the receiving side gets a {@link RemoteObject} proxy rather than the
   * bytes for the serialized object.
   * @author Nathan Sweet <misc@n4te.com> */
  static public class RemoteObjectSerializer extends Serializer {
    public void write (Kryo kryo, Output output, Object object) {
      Connection connection = (Connection)kryo.getContext().get("connection");
      int id = getRegisteredID(connection, object);
      if (id == Integer.MAX_VALUE) throw new KryoNetException("Object not found in an ObjectSpace: " + object);
      output.writeInt(id, true);
    }
View Full Code Here

      output.writeInt(id, true);
    }

    public Object read (Kryo kryo, Input input, Class type) {
      int objectID = input.readInt(true);
      Connection connection = (Connection)kryo.getContext().get("connection");
      return ObjectSpace.getRemoteObject(connection, objectID, type);
    }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryonet.Connection

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.