[ale] Pulling IP address from server.
JK
jknapka at kneuro.net
Mon Jul 27 16:11:48 EDT 2009
There seem to be a zillion ways to go about this. The most portable,
however, is probably to invoke the standard Unix library functions
that deal with name and address resolution:
// These two can be made to do the job, provided you can figure out
// the right host-name to use for the interface of interest:
gethostname()
gethostbyname()
// But this one seems a lot more convenient.
getifaddrs()
-- JK
Atlanta Geek wrote:
> What is the best way to identify the server's IP address from
> ruby/perl/python/C.
> I found a chunk of code parsing the results of ifconfig and I'm always
> concerned when I see this type of thing.
>
> Also does changing the default language of a server affect the output
> of these commands at all.
>
More information about the Ale
mailing list