How to determine own IP
Michael Bauer
Mike_B at T-Online.de
Mon Feb 19 04:58:48 EST 2001
Donn Cave wrote:
> Quoth Michael Bauer <Mike_B at T-Online.de>:
> ...
> | 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.
>
> If you have a connected socket s, s.getsockname() will return the
> IP address and port number of the local endpoint.
Hmm, seems even better than the first solution!
Thanks, Mike
--
Excuse my poor english...
More information about the Python-list
mailing list