sockets: bind to external interface

Jean-Michel Pichavant jeanmichel at sequans.com
Tue Apr 26 05:24:18 EDT 2011


Hans Georg Schaathun wrote:
> Is there a simple way to find the external interface and bind a
> socket to it, when the hostname returned by socket.gethostname()
> maps to localhost?
>> What seems to be the standard ubuntu configuration lists the local
> hostname with 127.0.0.1 in /etc/hosts. (I checked this on two ubuntu
> boxen, on only one of which I am root.) Thus, the standard solution
> of binding to whatever socket.gethostname() returns does not work.
>> Has anyone found a simple solution that can be administered without
> root privileges? I mean simpler than passing the ip address 
> manually :-)
>> TIA
>Hi,
Use the address 0.0.0.0
JM


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /