public void SendPong(NetworkingPlayer playerRequesting, DateTime time) { OUTER_BM2B_Pong_Resp msg = new OUTER_BM2B_Pong_Resp(); msg.receivedTimestep = (ulong)time.Ticks; SendMessage <OUTER_BM2B_Pong_Resp>(msg, playerRequesting.TcpClientHandle); }
public void SendPong(DateTime time) { OUTER_BM2B_Pong_Resp msg = new OUTER_BM2B_Pong_Resp(); msg.receivedTimestep = (ulong)time.Ticks; SendMessage <OUTER_BM2B_Pong_Resp>(msg); }
public void OnPongMessage(OUTER_BM2B_Pong_Resp msg, NetworkingPlayer player) { DateTime received = new DateTime((long)msg.receivedTimestep); // 现在接收到反馈ping的时间 - 自己发送ping是的时间 TimeSpan ms = DateTime.UtcNow - received; // 接收都ping的反馈 OnPingRecieved(ms.TotalMilliseconds, player); }