How to tell if Internet access is available?

  • Thread starter Thread starter Jon Pope
  • Start date Start date
J

Jon Pope

Is there a way to determine if the local machine has access to the internet?

Cheers, Jon
 
Try this

[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int Description,
int ReservedValue ) ;

Usage -

int Desc ;
bool IsIntenetAvailable = InternetGetConnectedState( out Desc, 0) ;

Desc may give the following values

INTERNET_CONNECTION_CONFIGURED
INTERNET_CONNECTION_LAN
INTERNET_CONNECTION_MODEM
INTERNET_CONNECTION_MODEM_BUSY
INTERNET_CONNECTION_OFFLINE
INTERNET_CONNECTION_PROXY
INTERNET_RAS_INSTALLED
 
Back
Top