03-20-07 12:27 PM
"Henrik Goldman" <henrik_goldman@mail.tele.dk> writes:
> Hello,
>
> I would like to enumerate all ip adresses on my current machine in a
> platform independent way. The code should work across several unix
> platforms.
>
> Is there an easy way to acomplish this?
No.
For example, POSIX doesn't specify this kind of things.
AFAIK, there is not standard API to do it independently of the platform.
You could implement a de-facto standard library that would gather all
the ways it can be done on all the platforms and export the
functionality under a common API. That won't be easy.
Another way to do it, perhaps easier, but it won't work always nor
everywhere, is to use ifconfig and try to parse its output. I say
try, because of course, the output of these commands vary from system
to system and from time to time, and on some systems it's even not
named ifconfig, but IPCONFIG.EXE...
--
__Pascal Bourguignon__
http://www.informatimago.com
http://pjb.ogamita.org
[ Post a follow-up to this message ]
|