How to determine own IP

Bryan Mongeau bryan at
Mon Feb 19 01:14:47 EST 2001

Michael Bauer wrote:

> 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?

Umm, I won't pretend to understand your entire protocol from this brief 
description but I do applaud your attempt and your choice of programming 
language. However, from what I understand, it sounds like your scheme won't 
scale well with many users due to the high number of ping/pongs.

Learn from the mistakes of others:

Good luck and I apologize if this problem does not apply to your protocol.
Bryan Mongeau
Lead Developer, Director
eEvolved Real-Time Technologies Inc.

"This is one of the hardest lessons for humans to learn. We cannot admit 
that things might be neither good nor evil, neither cruel nor kind, but 
simply callous - indifferent to all suffering, lacking all purpose." -- 
Richard Dawkins

More information about the Python-list mailing list