Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect Internet V. local lan connection

Is there anyway with Windows api to detect whether a Windows 7 computer's network connection is an internet connection or a LAN connection without internet access? Windows 7 and Vista indicate this in the network icon (Local only v. Local and Internet), is there anyway to grab that information progammatically?

like image 544
MattR Avatar asked Apr 20 '10 18:04

MattR


2 Answers

http://msdn.microsoft.com/en-us/library/aa370750(VS.85).aspx describes the difference between IsConnected and IsConnectedToInternet. Windows 7 only. I don't have a native code sample handy, sorry.

like image 113
Kate Gregory Avatar answered Oct 06 '22 22:10

Kate Gregory


Pinging 4.2.2.2 is a common means of determining if internet connectivity is present.

The story behind this lies here.

like image 36
Adam Robinson Avatar answered Oct 06 '22 23:10

Adam Robinson