예제 #1
0
        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 { }
        }
예제 #2
0
 public static bool PingHost(out SystemNetworkInformation.IPStatus status, string hostName = "unity.com")
 {
     return(PingIP(out status, GetHostIPV4Address(hostName)));
 }