Question

I try to use getaddrinfo() in my application which should determine whether I am connected to the internet. As long as getaddinfo() is able to return successfully everything is OK. But as soon as I disconnect my computer from the router the execution of the function fails and takes about 10 seconds.

Is there a solution to fix this or is there a better function to check whether I am connected to the internet or not?

Note: A similar question has already been asked here but disabling the DNSClient service didn't work for me.

Était-ce utile?

La solution

The BOOL InternetGetConnectedState( Out LPDWORD lpdwFlags, In DWORD dwReserved ) function could be a good choice. Thanks to Damon.


The InternetGetConnectedState function exists for a reason. - @Damon

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top