#!/usr/bin/perl use Socket; use strict; sub ShowIPLocalInfo { my @hostent = gethostbyname(undef) or return 0; print "name: ",shift @hostent,"\n"; # the name print "alias: ",shift @hostent,"\n"; # not always available print "addrtype: ",shift @hostent,"\n"; print "length: ",shift @hostent,"\n"; print "\nOwn Ip-Addresses:\r\n"; print "\t",inet_ntoa($_), "\n" foreach (@hostent); } ShowIPLocalInfo();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Getting own ip-addresses!
by merlyn (Sage) on Mar 01, 2004 at 00:35 UTC | |
by Anonymous Monk on Mar 01, 2004 at 05:30 UTC | |
by esskar (Deacon) on Mar 01, 2004 at 04:40 UTC | |
|
Re: Getting own ip-addresses!
by Anonymous Monk on Mar 01, 2004 at 05:18 UTC | |
|
Re: Getting own ip-addresses on Win32 machines
by meetraz (Hermit) on Mar 01, 2004 at 22:33 UTC |