I have this:
$SIG{"ALRM"} = sub {close(SOCKET); };
alarm '5';
socket(SOCKET, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
$iaddr = inet_aton($host);
$paddr = sockaddr_in($myport, $iaddr);
if (connect(SOCKET, $paddr)) {
$SIG{"ALRM"} = sub { close(SOCKET); &outage($host); exit(0); };
alarm '5';
socket(TS, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
$paddrr = sockaddr_in($myport, $iaddr);
connect(TS, $paddrr);
recv (TS, $buff, $responselength, '');
if ($buff eq $myresponse) {
&do9094stuff($host,$region);
exit(0);
} else {
#print "$host: Hung Port Detected!\n";
close(SOCKET);
&outage($host);
exit(0);
}
} else {
&outage($host);
}
I know that the distinguishing needs to be done in that last else, but I have no idea where to start..
Originally posted as a Categorized Question.