Enumerate ip addresses
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Enumerate ip addresses




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Enumerate ip addresses  
Henrik Goldman


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-07 06:29 PM

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?

Thanks.

-- Henrik







[ Post a follow-up to this message ]



    Re: Enumerate ip addresses  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
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 ]



    Re: Enumerate ip addresses  
Bin Chen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-20-07 12:27 PM

On Mar 20, 1:59 am, "Henrik Goldman" <henrik_gold...@mail.tele.dk>
wrote:
> 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?
>
I think the easiest and most portable is parse the output of ifconfig.







[ Post a follow-up to this message ]



    Re: Enumerate ip addresses  
David Schwartz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-21-07 12:19 AM

On Mar 19, 10:59 am, "Henrik Goldman" <henrik_gold...@mail.tele.dk>
wrote:
> 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?
>
> Thanks.
>
> -- Henrik

Google 'SIOCGIFCONF' for an approach that works on many UNIXes.

DS






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:38 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register