HTTP, Proxy, DNS, generator nahodnych cisel a delay
Honza Pazdziora
adelton na informatics.muni.cz
Pondělí Listopad 1 10:57:51 MET 1999
> > 2) Jak zjistim IP adresu pocitace pomoci DNS serveru?
>
> use Net::DNS;
>
> my $host=shift;
>
> my $res=new Net::DNS::Resolver;
>
> my @DNSHOSTADDRS = ();
>
> my $query = $res->query($host, "A");
>
> if ($query) {
> my $rr;
> foreach $rr ($query->answer) {
> # print $rr->type,"\n";
> next unless $rr->type eq "A";
> push @DNSHOSTADDRS, $rr->address ;
> }
> }
Proc takhle slozite?
Ciste podle perlfunc(1) jde
my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname('aisa');
local $" = '.';
for (@addrs) { @ip = unpack "C4", $_; print "@ip\n" }
__END__
------------------------------------------------------------------------
Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain, ...
------------------------------------------------------------------------
Další informace o konferenci Perl