Ping not returning a value in most cases

I’m currently creating a server browser in my game that includes a ping column. I’m getting the ping using something like this:

Ping myPing = new Ping(myMatchIpAddress);
while (!myPing.isDone)
    yield return null;
Debug.Log("Ping: " + myPing.time);

The problem: This is only working on about 25% of the games that are being played right now. The others never return a value.

myMatchIpAddress is being obtained from the game lobby’s data, and was originally found on the server’s end using something like this:

Network.Connect("http://www.google.com");
while (Network.player.externalIP == "" || Network.player.externalIP == "UNASSIGNED_SYSTEM_ADDRESS")
    yield return null;
Network.Disconnect();
Debug.Log("External IP: " + Network.player.externalIP);

This seems to be getting the server’s external IP address fine.

Any ideas on why there seems to be such an issue pinging such a large number of these IP addresses? Am I going about this wrong in some way?

Many home routers, or computers in general, no longer respond to the PING cmd, so you can not get values back, and thus no data.

I figured it was something along those lines.

Are there any known workarounds to this sort of thing, or is it just not feasible to do this anymore?

You can get the ping to a “known” server that you run someplace - like a VPS, Cloud, EC2 - and “ping” that, and have all the players ping that known machine, which could then return the “average” ping, or something? You can also just punt and only show RTT/Ping for games the player is currently in… Or, from a running game, average the PING times in the game itself and report those to a server, or update the Lobby listing, rather then the client hitting the server itself… Pretty much all are kinda crappy solutions. Good luck!