Cover V07, I01
Article
Listing 1
Listing 2

jan98.tar


Listing 1: webcheck.pl

#!/usr/local/bin/perl

require ("/perlprog/sockslib.pl");

SOCKSinit();

@webservers = ("netsd.server.internal.com:80:/:6178",
"www.external.com:80:/:2500"
);

for ($i=0; $i < $#webservers+1; $i++)
{
($hostname,$port,$directory,$size) = split(":",$webservers[$i]);
$a = &Rconnect($hostname,$port);
print SOCKS_SOCKET ("GET $directory\n");

$num = 0;

# keeps a running total of the number of characters returned

while ($line = <SOCKS_SOCKET>)
{
$num = $num + length($line);
}
if ($num == $size)  {
print ("host: $hostname:$port checks OK\n");
}
else {
print ("host: $hostname:$port has a problem ($num <>
$size)!\n");
}
}
exit(0);

# End of File