Skip to content

InternetChecker

InternetChecker is a utility class. It provides functionality to check for an active internet connection by pinging well-known websites like Google, Amazon, and Facebook. If any of these sites respond, it is assumed that an active internet connection is available.

Example Usage

To use InternetChecker, simply call its IsInternetAvailable method. This method returns true if an internet connection is detected, and false otherwise.

using System;
using ByteCobra.Updater.Client;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        bool isInternetAvailable = await InternetChecker.IsInternetAvailable();
        Console.WriteLine($"Internet Available: {isInternetAvailable}");
    }
}

This example demonstrates how to check internet connectivity in a console application using the InternetChecker. The result is printed to the console, indicating whether an active internet connection is present.