PSO2SERVER/Server/Protocol/Handlers/11-ClientHandler/11-0D-ClientPing.cs

27 lines
818 B
C#
Raw Normal View History

2024-09-16 02:56:02 +08:00
using System;
using System.IO;
using PSO2SERVER.Protocol.Packets;
2024-09-16 02:56:02 +08:00
namespace PSO2SERVER.Protocol.Handlers
2024-09-16 02:56:02 +08:00
{
[PacketHandlerAttr(0x11, 0x0D)]
2024-12-03 13:18:58 +08:00
public class ClientPing : PacketHandler
2024-09-16 02:56:02 +08:00
{
#region implemented abstract members of PacketHandler
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
2024-12-03 18:17:43 +08:00
//var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length);
//Logger.WriteHex(info, data);
2024-09-16 02:56:02 +08:00
var reader = new PacketReader(data, position, size);
var clientTime = reader.ReadUInt64();
2024-12-03 18:17:43 +08:00
var serverTime = Helper.Timestamp(DateTime.UtcNow);
context.SendPacket(new ClientPongPacket(clientTime, serverTime));
2024-09-16 02:56:02 +08:00
}
#endregion
}
}