public static void SendPingWS(uint packet_idx) { c2ws.PingNet msg = PacketPools.Get(c2ws.msg.PING_NET) as c2ws.PingNet; msg.packet_id = packet_idx; msg.tick = Time.time; msg.flags = 0; ClientNetManager.Instance.Send(msg); }
/// <summary> /// ping网络 /// </summary> private void OnPingNet(PacketBase packet) { c2ws.PingNet msg = packet as c2ws.PingNet; long offset_time = Time.time - msg.tick; Log.Debug("收到第:" + msg.packet_id + " 时间:" + Time.time + " 延迟:" + offset_time); ws2c.PingNet rep_msg = PacketPools.Get(ws2c.msg.PING_NET) as ws2c.PingNet; rep_msg.packet_id = msg.packet_id; rep_msg.tick = msg.tick; rep_msg.flags = msg.flags; ServerNetManager.Instance.SendProxy(msg.client_uid, rep_msg); }