zoukankan      html  css  js  c++  java
  • c# 判断是否有网

    芮源:
     public class IsInternet
        {
            /// <summary>
            /// 判断是否有网
            /// </summary>
            /// <returns>true为有网,false为无网</returns>
            public bool IsInternetAvailable()
            {
                try
                {
                    Dns.GetHostEntry("www.google.com"); //using System.Net;
                    return true;
                }
                catch (SocketException ex)
                {
                    return false;
                }
            }
        }

    芮源:
     IsInternet ty = new IsInternet();

    芮源:
     if (ty.IsInternetAvailable()) return;

  • 相关阅读:
    shell 参数个数
    小坑也难受
    MaHua简介
    airflow Operators
    datax
    T-SQL 更新表操作
    T-SQL时间函数
    linux学习网站
    好看的页面
    函数-1
  • 原文地址:https://www.cnblogs.com/ruiyuan/p/11445586.html
Copyright © 2011-2022 走看看