How to get all IP addresses in python?

Afanasiy abelikov72 at hotmail.com
Sat Jul 12 02:51:33 CEST 2003


On Fri, 11 Jul 2003 14:50:00 -0400, "Yun Mao"
<maoy_REMOVE_IF_NOT_SPAM at cis.upenn.edu> wrote:

>Sorry, this still doesn't work very well on my machine.
>
>>>> print socket.getaddrinfo(socket.gethostname(), None)
>[(2, 1, 6, '', ('127.0.0.1', 0)), (2, 2, 17, '', ('127.0.0.1', 0)), (2, 3,
>0, '', ('127.0.0.1', 0))]
>>>>
>
>Any ideas? Thanks!

FYI, It works perfectly on my Windows 2000 machine.

... import socket
... print socket.getaddrinfo(socket.gethostname(), None)
[(2, 0, 0, '', ('124.181.217.203', 0)), (2, 0, 0, '', ('169.254.25.142',
0)), (2, 0, 0, '', ('169.254.218.201', 0))]
...

Good to know too!




More information about the Python-list mailing list