zoukankan      html  css  js  c++  java
  • C#检测是否联网

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Runtime.InteropServices;

    namespace LocalApp.ConsoleApp.Core

    {

        public class Net

        {

            [DllImport("wininet")]

            private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);

            /**//// <summary>

            /// 检测本机是否联网

            /// </summary>

            /// <returns></returns>

            public static bool IsConnectedInternet()

            {

                int i = 0;

                if (InternetGetConnectedState(out i, 0))

                {

                    //已联网

                    return true;

                }

                else

                {

                    //未联网

                    return false;

                }

            }

        }

    }

  • 相关阅读:
    centos 系统时间设置
    centos6 centos7 配置开机启动服务
    centos6.9 samba配置
    vmware异常关闭后导致虚拟机无法打开问题解决办法
    try using -rpath or -rpath-link
    ZR#988
    提高十连测day3
    Atcoder ABC 141
    ZR#957
    ST表
  • 原文地址:https://www.cnblogs.com/yinchuan/p/5249993.html
Copyright © 2011-2022 走看看