判断内外网环境
Posted p201521440004
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了判断内外网环境相关的知识,希望对你有一定的参考价值。
#include "stdafx.h" #include "windows.h" #include <Sensapi.h> #include <iostream> #include <Wininet.h> #pragma comment(lib, "Sensapi.lib") #pragma comment(lib, "Wininet.lib") using namespace std; int _tmain() { do { //IsNetworkAlive DWORD dw; BOOL isConnect = ::IsNetworkAlive( &dw ); if(isConnect) cout << "IsNetworkAlive连接" <<endl; else cout << "IsNetworkAlive未连接" <<endl; //InternetGetConnectedState DWORD dw2; BOOL ret = InternetGetConnectedState(&dw2, 0); if (ret) cout << "InternetGetConnectedState连接" <<endl; else cout << "InternetGetConnectedState未连接" <<endl; //InternetCheckConnection BOOL bConnected = InternetCheckConnection(_T("http://www.baidu.com"), FLAG_ICC_FORCE_CONNECTION, 0); if (bConnected) cout << "InternetCheckConnection连接" <<endl; else cout << "InternetCheckConnection未连接" <<endl; //IsDestinationReachable(_T("http://www.google.com"), ) } while (FALSE); getchar(); return 1; }
以上是关于判断内外网环境的主要内容,如果未能解决你的问题,请参考以下文章
内外网共存环境迁移Exchange 2010至Exchange 2016