in reply to Tracert or resolve machine name
it just locks up my command prompt (Windows XP).
Your program takes a long time to run because tracert takes a long time to run.
All I want to do is scan an IP and get the machine name back-
tracert has nothing to do with that. You want gethostbyaddr.
use Socket qw( inet_aton AF_INET); my $addr = '209.197.123.153'; my ($name) = gethostbyaddr(inet_aton($addr), AF_INET) or do { die "No name for addr $addr\n" if $!==0; die "gethostbyaddr: $!\n"; }; print("$name\n"); # perlmonks.pair.com
|
|---|