Perl
Chilkat2 Perl
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
my $socket = Chilkat2::Socket->new;
my $maxWaitMs = 10000;
my $ipAddr = $socket->DnsLookup('www.chilkatsoft.com', $maxWaitMs);
if (!$socket->LastMethodSuccess) {
print $socket->LastErrorText, "\n";
exit;
}
print 'IP Address: ', $ipAddr, "\n";