void notifyReceived (Object object) { if (object instanceof Ping) { Ping ping = (Ping)object; if (ping.isReply) { if (ping.id == lastPingID - 1) { returnTripTime = (int)(System.currentTimeMillis() - lastPingSendTime); if (TRACE) trace("kryonet", this + " return trip time: " + returnTripTime); } } else { ping.isReply = true; sendTCP(ping); } } Listener[] listeners = this.listeners; for (int i = 0, n = listeners.length; i < n; i++) listeners[i].received(this, object); }
void notifyReceived(Object object) { if (object instanceof Ping) { Ping ping = (Ping) object; if (ping.isReply) { if (ping.id == lastPingID - 1) { returnTripTime = (int) (System.currentTimeMillis() - lastPingSendTime); if (TRACE) trace("kryonet", this + " return trip time: " + returnTripTime); } } else { ping.isReply = true; sendTCP(ping); } } Listener[] listeners = this.listeners; for (int i = 0, n = listeners.length; i < n; i++) listeners[i].received(this, object); }
/** Requests the connection to communicate with the remote computer to determine a new value for the * {@link #getReturnTripTime() return trip time}. When the connection receives a {@link FrameworkMessage.Ping} object with * {@link Ping#isReply isReply} set to true, the new return trip time is available. */ public void updateReturnTripTime () { Ping ping = new Ping(); ping.id = lastPingID++; lastPingSendTime = System.currentTimeMillis(); sendTCP(ping); }
public KryoSerialization (Kryo kryo) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new Input(byteBufferInputStream, 512); output = new Output(byteBufferOutputStream, 512); }
public JsonSerialization () { json.addClassTag("RegisterTCP", RegisterTCP.class); json.addClassTag("RegisterUDP", RegisterUDP.class); json.addClassTag("KeepAlive", KeepAlive.class); json.addClassTag("DiscoverHost", DiscoverHost.class); json.addClassTag("Ping", Ping.class); json.setWriter(writer); }
public KryoSerialization (Kryo kryo) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new ByteBufferInput(); output = new ByteBufferOutput(); }
public MyKryoSerialization(Kryo kryo, int objectSize) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new Input(byteBufferInputStream, objectSize); output = new Output(byteBufferOutputStream, objectSize); }
public KryoSerialization(Kryo kryo) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new ByteBufferInput(); output = new ByteBufferOutput(); }
public JsonSerialization() { json.addClassTag("RegisterTCP", RegisterTCP.class); json.addClassTag("RegisterUDP", RegisterUDP.class); json.addClassTag("KeepAlive", KeepAlive.class); json.addClassTag("DiscoverHost", DiscoverHost.class); json.addClassTag("Ping", Ping.class); json.setWriter(writer); }
public JsonSerialization () { json.addClassTag("RegisterTCP", RegisterTCP.class); json.addClassTag("RegisterUDP", RegisterUDP.class); json.addClassTag("KeepAlive", KeepAlive.class); json.addClassTag("DiscoverHost", DiscoverHost.class); json.addClassTag("Ping", Ping.class); }
/** * Requests the connection to communicate with the remote computer to * determine a new value for the {@link #getReturnTripTime() return trip * time}. When the connection receives a {@link FrameworkMessage.Ping} * object with {@link Ping#isReply isReply} set to true, the new return trip * time is available. */ public void updateReturnTripTime() { Ping ping = new Ping(); ping.id = lastPingID++; lastPingSendTime = System.currentTimeMillis(); sendTCP(ping); }