public static bool PingIP(out SystemNetworkInformation.IPStatus status, string ipAddress) { status = SystemNetworkInformation.IPStatus.Unknown; try { var ping = new SystemNetworkInformation.Ping(); var reply = ping.Send(ipAddress, (int)TimeOutms, _pingBuffer, _pingOptions); status = reply.Status; if (reply.Status == SystemNetworkInformation.IPStatus.Success) { return(true); } return(false); } catch (Exception e) { Debug.LogError(e); return(false); } finally { } }
public static bool PingHost(out SystemNetworkInformation.IPStatus status, string hostName = "unity.com") { return(PingIP(out status, GetHostIPV4Address(hostName))); }