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;

                }

            }

        }

    }

  • 相关阅读:
    RK3399之时钟
    C之{}注意点
    ARM之不用段寄存猜想
    linux驱动之入口
    android之HAL
    git
    消息中间之ActiveMQ
    Maven之阿里云镜像仓库配置
    清理Oracle临时表空间
    Tomcat控制台日志输出到本地文件
  • 原文地址:https://www.cnblogs.com/shuang121/p/3166405.html
Copyright © 2011-2022 走看看