/// <summary>
/// 网络检测
/// </summary>
public class NetHelper
{
private static ILog LOG = LogManager.GetLogger(typeof(NetHelper));
private const int INTERNET_CONNECTION_MODEM = 1;
private const int INTERNET_CONNECTION_LAN = 2;
[System.Runtime.InteropServices.DllImport("winInet.dll")]
private static extern bool InternetGetConnectedState(ref int dwFlag, int dwReserved);
/// <summary>
/// 判断本地的连接状态
/// </summary>
/// <returns></returns>
public static bool LocalConnectionStatus()
{
System.Int32 dwFlag = new Int32(<
C#实战小技巧(十七):检测网络连接状况(代码示例)
最新推荐文章于 2022-07-05 13:34:06 发布
本文将介绍如何使用C#编程语言来检测应用程序的网络连接状况,提供实用的代码示例,帮助开发者实现网络连通性的检查功能。
摘要由CSDN通过智能技术生成