C#检测本机是否联网
2024-10-16 08:51:02
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;
}
}
}
最新文章
- NOIP2004火星人
- 推公式 HDU 2552
- windows shell api SHEmptyRecycleBin 清空回收站
- Entity Framework7 有哪些不同?现在开发到什么程度了?
- ajax 调用 JSON.parse();
- MySQL日期时间函数大全(转)
- 贴代码—CF230 DIV1 B
- 编译器失败,错误代码为xxx
- Android开发UI之ViewPager及PagerAdapter
- tomcat环境变量配置
- C语言零移位操作
- 关于我们-EIBOA易博男装-互联网品质男装品牌-在线销售男士西服,衬衫,外套,西裤,领带|全场免运费,30天退换货保障
- iOS开发 使用Xcode自带的Leaks
- C/C++ 语言中的表达式求值(原文作者:裘宗燕)
- Vue 进阶之路(二)
- libavcodev may be vulnerable or is not supported, and should be updated for play video
- Nginx禁止IP直接访问网站
- Java实现inputstream流的复制
- Django+nginx+uwsgi部署教程
- JavaBasic_正则表达式