diff --git a/AM2RLauncher/AM2RLauncherLib/HelperMethods.cs b/AM2RLauncher/AM2RLauncherLib/HelperMethods.cs index 013af9c..dd96a5b 100644 --- a/AM2RLauncher/AM2RLauncherLib/HelperMethods.cs +++ b/AM2RLauncher/AM2RLauncherLib/HelperMethods.cs @@ -2,6 +2,7 @@ using System; using System.IO; using System.Net; +using System.Net.NetworkInformation; using System.Security.Cryptography; namespace AM2RLauncherLib; @@ -141,18 +142,14 @@ public static class HelperMethods } /// - /// Checks if we currently have an internet connection, by pinging github. + /// Checks if we currently have an internet connection, by pinging GitHub. /// /// if we have internet, if not. public static bool IsConnectedToInternet() { log.Info("Checking internet connection..."); - HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://github.com"); - try - { - request.GetResponse(); - } - catch (WebException) + PingReply pingReply = new Ping().Send("https://github.com"); + if (pingReply?.Status != IPStatus.Success) { log.Info("Internet connection failed."); return false;