E
eloelo
I want to use four nameserver to look up a domain's IP.
But why the code below can lookup domain's IP only using one nameserver.
#!/usr/bin/perl
use Net:NS;
@ns=('222.33.11.2','223.55.4.3','223.55.4.2','223.55.4.7');
for($i=0;$i<4;$i++)
{
my $res = Net:NS::Resolver->new;
$res->nameservers($ns);
my $query = $res->search("www.bdchina.com");
if ($query)
{
foreach my $rr ($query->answer)
{
next unless $rr->type eq "A";
print "$ns---->",$rr->address, "\n";
}
}
else
{
warn "$ns---->query failed: ", $res->errorstring, "\n";
}
}
But why the code below can lookup domain's IP only using one nameserver.
#!/usr/bin/perl
use Net:NS;
@ns=('222.33.11.2','223.55.4.3','223.55.4.2','223.55.4.7');
for($i=0;$i<4;$i++)
{
my $res = Net:NS::Resolver->new;
$res->nameservers($ns);
my $query = $res->search("www.bdchina.com");
if ($query)
{
foreach my $rr ($query->answer)
{
next unless $rr->type eq "A";
print "$ns---->",$rr->address, "\n";
}
}
else
{
warn "$ns---->query failed: ", $res->errorstring, "\n";
}
}