Hi all,
Im trying to query 8 internal dns servers at the same time and make sure
that there are at least 2 A records for the Specified device, but I cant
seem to get reliable results, I could do it by sending a query to each
server and waiting but that takes quite some, whereas using
Net::DNS->bgsend I am able to do it in 5% of the time.
For some reason my code is giving me inconsistant results, some that
have records are being returned with no records etc, but I cannot figure
out what the problem might be, I was hoping that someone could lead me
in the right direction.
%table is in the form of $table{MACADDRESS}
Using Net::DNS and IO::Select
most code was reused from Net::DNS demo mresolv (probably my problem).
---begin---
$d = Net::DNS::Resolver->new;
..........
foreach (sort {$table{$a} cmp $table{$b}} keys (%table)) {
$sel = IO::Select->new;
$dns{$_}{RESULT} = 0;
print $_, "\n";
foreach $server (@nameservers) {
$d->nameservers("$server");
$bgsock = $d->bgsend("a$_.int.domain");
$sel->add($bgsock);
}
for (@ready = $sel->can_read(10);@ready;@ready = $sel->can_read(1)) {
foreach $sock (@ready) {
$sel->remove($sock);
my $ans = $d->bgread($sock);
next unless $ans;
foreach $rr ($ans->answer) {
$dns{$_}{RESULT}++ if ($rr->address);
$rr->print;
}
}
}
}
---end---
Thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>