代理上网,Dns.GetHostEntry(“www.baidu.com”).AddressList[0].ToString()出错,怎么解决?

解决方案 »

  1.   

    Message "请求的名称有效,但是没有找到请求的类型的数据。" string
      

  2.   

    试试这样ProcessStartInfo start = new ProcessStartInfo("Ping.exe");
    start.Arguments = "www.baidu.com -n 1"; //设置命令参数
    start.CreateNoWindow = true; //不显示dos命令行窗口
    start.RedirectStandardOutput = true; //
    start.RedirectStandardInput = true; //
    start.UseShellExecute = false; //是否指定操作系统外壳进程启动程序
    Process p = Process.Start(start);
    StreamReader reader = p.StandardOutput; //截取输出流
    string line = reader.ReadLine();
    line = reader.ReadLine();
    string result = Regex.Match(line, @"(?<=\[)[\d.]+").Value;//result就是你要的ip地址
    IPAddress ip = IPAddress.Parse(result);//转换为IPAddress
      

  3.   

    要访问的服务器ping屏了,不可以使用。
      

  4.   

    代理以后,Ping功能不能使用了。