Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PING错误C#-参数名称:主机名_C#_Unity3d_Ping - Fatal编程技术网

PING错误C#-参数名称:主机名

PING错误C#-参数名称:主机名,c#,unity3d,ping,C#,Unity3d,Ping,我需要帮助。。我正在检查PC的用户是否连接到Internet。。 它对我有用。。对很多人来说。。但对某人来说不是 它正在将其写入输出_log.txt 错误: ArgumentNullException: Argument cannot be null. Parameter name: hostName at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:

我需要帮助。。我正在检查PC的用户是否连接到Internet。。 它对我有用。。对很多人来说。。但对某人来说不是

它正在将其写入输出_log.txt

错误:

ArgumentNullException: Argument cannot be null.

Parameter name: hostName
  at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0 

  at System.Net.NetworkInformation.Ping.GetNonLoopbackIP () [0x00000] in <filename unknown>:0 

  at System.Net.NetworkInformation.Ping.SendPrivileged (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x00000] in <filename unknown>:0 

  at System.Net.NetworkInformation.Ping.Send (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x00000] in <filename unknown>:0 

  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x00000] in <filename unknown>:0 

  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress, Int32 timeout, System.Byte[] buffer) [0x00000] in <filename unknown>:0 

  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress, Int32 timeout) [0x00000] in <filename unknown>:0 

  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0 

  at (wrapper remoting-invoke-with-check) System.Net.NetworkInformation.Ping:Send (string)

  at Internet.Connection.Check () [0x00000] in <filename unknown>:0 

  at MyGame.Load.Loader.StartLoading () [0x00000] in <filename unknown>:0 

  at Loader+<Start>c__IteratorA.MoveNext () [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

所以请帮助那个人,他们的平台是什么?Mb。检查.NET版本可能已修复。。使用其他脚本
namespace Internet
{
    using System;
    using System.Net.NetworkInformation;
    using UnityEngine;

    public class Connection
    {
        public static void Check()
        {
            System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
            if (ping.Send("89.203.249.74").Status != IPStatus.Success)
            {
                Debug.Log("NO INTERNET CONNECTION");
                Application.Quit();
            }
        }
    }
}