Enumerating Network Adapters

Olivier Parisy olivier.parisy at free.fr
Sun Aug 29 18:25:33 EDT 2004


Diez B. Roggisch wrote:

> This has been discussed quite a few times on this NG, search google groups.
> However IMHO there is no general system built-in way (AFAIK not even posix)
> for doing this, you'll end up parsing tool output anyway...

I should have done this first, my mistake...

But actually, a previously posted message suggests a portable way to get
the platform IPs. Citing John Abel :

 > socket.gethostbyaddr( socket.gethostname() ) will return all the
 > details that you need to know.  For example, the output of that
 > command on my machine is :
 >
 > ('hallows', [], ['101.101.101.102', '10.253.1.118'])

Are there some pitfalls I'm not aware of ?

Thanks,
Olivier Parisy.




More information about the Python-list mailing list