How to Check Internet Connection Availability Using Qt/C++

The one and only correct answer is, you have to check if you can access some famous (like Google or Facebook) server on the internet. This question comes up a lot and surprisingly enough there is no clear answer for it because being connected to the internet can have different meanings in different countries. For example in my home country of Iran (and in China and some other countries too), Facebook and some other popular websites are forbidden under the law, so being connected to the Internet does not mean being connected to Facebook, and vice versa. So, you have to use a website which is not forbidden in the country your app is going to be used, and then use the simple approach below:

Continue reading “How to Check Internet Connection Availability Using Qt/C++”