How to get IP address

Nagy László Zsolt nagylzs at
Mon Mar 3 09:49:37 CET 2003

> I'm still lost :) How are you getting the hostname dynamically?  The 
> hostname is assigned during the install of the OS.  Changing this (on 
> windows) will require a reboot.  Where I work, every machine is DHCP, 
> but they all have hostnames assigned to them when windows is installed.

This machine is a firewall. One side is connected to the internal 
network. It has address and a fixed hostname 'arwen'.
The other side is an ADSL connection. I get the IP address every time I 
connect. That IP address has one or more DNS names assigned.
This computer is a multi-hosted machine.  It has more than one IP 
addresses. You can see that gethostbyname('arwen') returns ''
because the host 'arwen' is in my local network. But I need 
to determine the external IP (that connects directly to Internet).

In windows, you can set the computer name which is not the same. It is a 
name of computer in Microsoft Windows Network.
I hope this helps.

  Laci 1.0

More information about the Python-list mailing list