Thread IP-Adr ermitteln (aber nicht localhost)
(28 answers)
Opened by roli at 2014-12-28 19:07
Schon Net::Domain und gethostbyname() ausprobiert?
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 use 5.010; use Net::Domain qw(hostname hostfqdn hostdomain domainname); say "hostname: ", hostname(); say "hostfqdn: ", hostfqdn(); say "hostdomain: ", hostdomain(); say "domainname: ", domainname(); my $host = hostfqdn() . '.'; use Socket; my $addr = inet_ntoa(scalar(gethostbyname($host))); print "Name= $host IP Adr=$addr <\n"; |