如何识别一个孤网 [英] How to identify an Isolated Network
本文介绍了如何识别一个孤网的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发一个C#.NET3.5应用程序。
I am developing a c# .Net3.5 application.
在应用程序检查使用的 的WinVerifyTrust。问题是,在孤立的网络(即无法上网,但该机还具有一个IP地址),这需要很长的时间(约20秒),直到返回的WinVerifyTrust
The applications checks the signature of files using WinVerifyTrust. The problem is that on isolated networks (i.e. no Internet access but machine still has an IP address) it takes a very long time (~20 seconds) until WinVerifyTrust returns.
有没有一种方法,以确定这种情况呢?
Is there a way to identify this situation?
推荐答案
您是否尝试过使用的Windows API
-
Have you tried using the Windows API
-
using System;
using System.Runtime;
using System.Runtime.InteropServices;
public class InternetCS
{
//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int Description, int ReservedValue );
//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}
}
这篇关于如何识别一个孤网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文