Re: Trouble with DSL Modem Watchdog

Hi Chorob;

Cool project! I think an improvement would be to modify your code to call your ISP's support line and complain about the outage! Anyway, I hope this helps.

My total connection failure count is always higher than my total connection success count.

I would recommend tweets as a diagnostic tool rather than an input to your "is my router working" routine. If the tweet is rejected because of being static, for example, it may not mean you don't have internet connectivity - that may help.

Also - watch what you do with your failure variable. You seem to increment it and then decrement it in the same test (Google) and in others(bing, google2) set it to 0 if it is greater than 0, then increment it anyway later.

Here is an improvement to debugability and code read perhaps - moving the tests into a new function, since they are (with exception to the above comments) the same would dramatically ease the burden of reading that long switch statement.

switch(programState)
{
  case GOOGLETEST:
      if(TestServerConnectivity(clientgoogle))
      {
      }
      else
       {
       }
       programState = BINGTEST;
       break;
   case BINGTEST:
      if(TestServerConnectivity(clientbing))
      {
      }
      else
       {
       }
       programState = GOOGLE2TEST;
       break;
}


bool TestServerConnectivity(Client &theClient)
{
    if(theClient.connect())
   {
       // connected.  do other stuff here.
       return true;
   }
   return false;
}

It may make troubleshooting easier for you.