문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top