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++”How to Find a Website’s IP Address Using Qt/C++
QHostInfo class provides an static function (lookupHost) that you can use to get any host’s (including a website’s) IP address quickly and efficiently.
Here is an example of how you can get Google’s IP Address using Qt/C++:
Continue reading “How to Find a Website’s IP Address Using Qt/C++”How to Find Local IP Addresses in Qt
Below is the approach I use to get all of the IP addresses for the local computer. Note that this method also gives you all Subnet Masks which you can then use to find all IP addresses in a subnet, say for scanning a Home Network or any similar purpose.
Continue reading “How to Find Local IP Addresses in Qt”