views:

303

answers:

2

It seems I am not the only one to have discovered this: http://forums.devx.com/showthread.php?t=72771

Actually both:

InternetGetConnectedState

InternetGetConnectedStateEx

are not reporting correctly. When I am connected, it returns 0x12 and when I an not connected it returns 0x10 (0x10 is not defined) http://msdn.microsoft.com/en-us/library/aa384705(VS.85).aspx

Anyone care to take a guess at the definition of 0x10 in WinXP SP3?

Having read on this forum some suggestions for testing for the presence of an internet connection (C/C++) like http://stackoverflow.com/questions/285860/how-can-i-programmatically-test-an-http-connection

I would write a WinHTTP function to return the headers of the servers main webpage, except the server I want to test a connection to, only runs CGI apps. I would prefer to not waste precious server memory and processor resources confirming thousands of clients connections.

any other suggestions?

A: 

Sure 0x10 is not a combination of the possible flags?

e.g. here I found WIN API Internet Get Connected State

INTERNET_CONNECTION_RAS_INSTALLED = 0x10
jitter
+1  A: 

InternetGetConnectedState/Ex() returns a DWORD that is a bitmask of multiple values. The value 0x12 is a combination of INTERNET_CONNECTION_LAN (0x02) and INTERNET_CONNECTION_RAS_INSTALLED (0x10). So, when you are connected, INTERNET_CONNECTION_LAN is being reported, and when you are disconnected, INTERNET_CONNECTION_LAN is being omitted.

Remy Lebeau - TeamB