Possible Duplicate:
Finding local IP addresses using Python's stdlib
To get my localhost IP address I do socket.gethostbyname(socket.gethostname())
. But it gives me the answer 127.0.0.1
.
If I do an_existing_socket.getsockname()[0]
I get the answer 0.0.0.0
.
I need my 'real' ip address (for instance 192.168.x.x) to modify a configuration file. How could I get it?