in reply to Whats wrong with this? & Timeouts

if ($mx1pop3|$mx1imap|mx1smtp) { print "<IMG SRC='http://www.xxx.com/images/up.gif' WIDTH=38 HEIGHT=2 +1>"; } else { print "<IMG SRC='http://www.xxx.com/images/down.gif' WIDTH=38 HEIGHT +=21>"; }
It is supposed to display the down gif when any one of the variables in brackets i.e ($mx1pop|$mx1imap) is not responding, but if i take one of the servers down, it waits for ages before still displaying the up gif.

In addition to the error that Ovid pointed out, you have a logic error as well. Since you want down.gif to be displayed if any of the servers is down, you want the up.gif to be displayed only when all of them are up. In other words, you should be using logical and, rather than logical or, in your if statements.

if ($mxlpop3 && $mxlimap && $mxlsmtp) { # Display up.gif } else { # Display down.gif }
-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Whats wrong with this? & Timeouts
by lostperls (Initiate) on Sep 09, 2002 at 22:27 UTC
    Thanks. i noticed the logic error just after posting that! D'oh. I'm still stuck on the timeouts tho....

      Specify appropriate Timeout arguments in your calls to the IO::Socket::INET constructor.

      -sauoq
      "My two cents aren't worth a dime.";
      
        can i just use Timeout => (10) ?