How to get IP address
sandorlevi at yahoo.com
Sun Mar 2 22:52:28 CET 2003
If you want to determine your external IP, AFAIK, you must ask a
machine that's external to your network. The simplest way is to visit
Nagy László Zsolt <nagylzs at freemail.hu> wrote in message news:<mailman.1046613969.13927.python-list at python.org>...
> >Nagy L=E1szl=F3 Zsolt <nagylzs at freemail.hu> wrote in message news:<mailm=
> an.1046487302.8558.python-list at python.org>...
> > =20
> >>I'm trying to get all inet addresses of a machine in python. Is there a=
> >>way to do it using
> >>the standard library? I found a solution on Google and in Python=20
> >>CookBook but they
> >>are platform dependent. I need a platform-independent solution. Thank=20
> >>you in advance.
> >> Laci 1.0
> >> =20
> >How about this? I only have one IP on my box so I do not know if this
> >will work for you..
> >You could probably use the loopback as the parameter, like:
> >Both of these will return a tuple in the form of (hostname, aliaslist,
> >ipaddrlist). This is in 7.2 of the Python docs if you need to check
> >other variations.
> Sorry, but this does not help me. I want to determine the IP address=20
> because I want to send my external
> IP address to a dynamic DNS provider (in an A record). I get my IP=20
> address with DHCP and I'm
> writting a program that assigns a DNS name to a given IP address. So my=20
> hostname may have a bad IP address
> assigned at the time when I need the IP address. IP address is a lower=20
> level than DNS name. I can have an IP
> address without hostname. Can you tell me a solution in the case when I=20
> have no valid DNS name?
> Laci 1.0
More information about the Python-list