<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
<blockquote type="cite"
cite="mid2a897f11.0303011133.3acdfc8@posting.google.com">
<pre wrap="">Nagy László Zsolt <a class="moz-txt-link-rfc2396E" href="mailto:nagylzs@freemail.hu"><nagylzs@freemail.hu></a> wrote in message news:<a class="moz-txt-link-rfc2396E" href="mailto:mailman.1046487302.8558.python-list@python.org"><mailman.1046487302.8558.python-list@python.org></a>...
</pre>
<blockquote type="cite">
<pre wrap="">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
CookBook but they
are platform dependent. I need a platform-independent solution. Thank
you in advance.
Laci 1.0
</pre>
</blockquote>
<pre wrap=""><!---->
How about this? I only have one IP on my box so I do not know if this
will work for you..
socket.gethostbyaddr(socket.gethostname())
You could probably use the loopback as the parameter, like:
socket.gethostbyaddr('localhost')
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.</pre>
</blockquote>
Sorry, but this does not help me. I want to determine the IP address because
I want to send my external<br>
IP address to a dynamic DNS provider (in an A record). I get my IP address
with DHCP and I'm <br>
writting a program that assigns a DNS name to a given IP address. So my hostname
may have a bad IP address <br>
assigned at the time when I need the IP address. IP address is a lower level
than DNS name. I can have an IP<br>
address without hostname. Can you tell me a solution in the case when I have
no valid DNS name?<br>
Thanks.<br>
<br>
Laci 1.0<br>
<br>
<br>
</body>
</html>