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

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

2012-03-09 00:00 302 查看
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);
}

}
}

$(document).ready(function(){dp.SyntaxHighlighter.HighlightAll('code');});

原文链接:
http://blog.csdn.net/vince6799/article/details/5876051
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: