How to determine own IP
donn at oz.net
Mon Feb 19 07:25:53 CET 2001
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.
Donn Cave, donn at oz.net
More information about the Python-list