1
TNet 3 Support / Weird TNManager.Ping Issue
« on: January 27, 2018, 04:28:14 PM »
I was trying to get TNManager.Ping setup so I could display the player's ping to the gameserver.
I was able to successfully Ping my UdpLobbyServer with its IP and port but if I tried to ping the actual gameserver the callback was never called.
The problem is in TNGameClient, case Packet.ResponsePing.
The "ip" variable is null for some reason so my callback would not get called.
I got the gameserver ping working but I had to ignore the is "ip" null check and remove IpEndPoint ipAddress from GameClient.OnPing.
Is there going to be any problems with this solution and can anyone tell me why the "ip" was always null after pinging my gameserver?
Here is the edited TNGameClient code:
I was able to successfully Ping my UdpLobbyServer with its IP and port but if I tried to ping the actual gameserver the callback was never called.
The problem is in TNGameClient, case Packet.ResponsePing.
The "ip" variable is null for some reason so my callback would not get called.
I got the gameserver ping working but I had to ignore the is "ip" null check and remove IpEndPoint ipAddress from GameClient.OnPing.
Is there going to be any problems with this solution and can anyone tell me why the "ip" was always null after pinging my gameserver?
Here is the edited TNGameClient code:
- public delegate void OnPing (int milliSeconds);
- case Packet.ResponsePing:
- {
- int ping = (int)(mMyTime - mPingTime);
- if (onPing != null) {
- onPing(ping);
- } else {
- mCanPing = true;
- mPing = ping;
- }
- break;
- }