Beispiel #1
0
        public static void DoPingRequest()
        {
            int port = MainForm.Conf.ServerPort;

            if (MainForm.Conf.IPMode == "IPv6")
            {
                port = MainForm.Conf.LANPort;
            }

            LastLiveCheck = Helper.Now;

            try
            {
                //using IPAddress in both as the website determines remoteip for ipv4 or uses ipv6 for both internal and external

                Wsa.PingAlive(MainForm.Conf.WSUsername, MainForm.Conf.WSPassword, port,
                              MainForm.Conf.IPMode == "IPv4", MainForm.IPAddress, MainForm.IPAddress);

                WebsiteLive = true;
                _pingIndex  = 0;
            }
            catch
            {
                WebsiteLive = false;
                _pingIndex  = Math.Min(_pingIndex + 1, PingDelays.Length - 1);
            }
        }
Beispiel #2
0
        public static void DoPingRequest()
        {
            int port = MainForm.Conf.ServerPort;

            if (MainForm.Conf.IPMode == "IPv6")
            {
                port = MainForm.Conf.LANPort;
            }

            LastLiveCheck = Helper.Now;
            string[] r = null;
            try
            {
                //using IPAddress in both as the website determines remoteip for ipv4 or uses ipv6 for both internal and external

                r = Wsa.PingAlive(MainForm.Conf.WSUsername, MainForm.Conf.WSPassword, port, MainForm.Conf.IPMode == "IPv4", MainForm.IPAddress, MainForm.IPAddress);
                if (r[0] != lastResponse)
                {
                    Logger.LogMessage("Ping: " + r[0]);
                }
                lastResponse = r[0];
                WebsiteLive  = true;
                _pingIndex   = 0;
            }
            catch (Exception ex)
            {
                WebsiteLive = false;
                Logger.LogException(ex, "Ping");
                _pingIndex = Math.Min(_pingIndex + 1, PingDelays.Length - 1);
            }
            _pingRequestThread = null;
        }