您的位置:首页 > 理论基础 > 计算机网络

检查网络是否可以连接互联网

2010-09-11 09:58 267 查看
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime;
using System.Runtime.InteropServices; namespace SmsSoft
{
public class CheckInternetConnection
{
/// <summary>
/// 用于检查网络是否可以连接互联网,true表示连接成功,false表示连接失败
/// </summary>
/// <returns></returns>
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(int Description, int ReservedValue);
public static bool CheckConnection()
{
int Description = 0;
return InternetGetConnectedState(Description, 0);
} }
} 原文地址:http://blog.csdn.net/vince6799/archive/2010/09/10/5876051.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: