How to determine own IP

Michael Bauer Mike_B at T-Online.de
Sun Feb 18 17:21:44 EST 2001


Hi *

I'm stuck with a kind of dumb problem. I'm implementing a project based on 
a distributed, decentralised network. Communication between nodes is 
established through xml-rpc.
For a new host to gather some other members of the network, it sends out a 
PING that is passed on through the net. Each host receiving the PING 
returns a PONG. Since the PONG is not sent directly to the new host but 
passed back through all hosts that passed on the PING, i need to store the 
IP of the answering hosts inside the PONG package.
Now, to the real problem :-)
If a host has more than one network adapter, how do i know which IP should 
i put inside  the PONG package? 
Specifically, when dealing with dial-up users who are also connected to a 
LAN, gethostbyname(gethostname()) always returns their internal adress.

Any ideas?
        



More information about the Python-list mailing list