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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top