sockets: bind to external interface

Hans Georg Schaathun hg at schaathun.net
Mon Apr 25 22:24:02 CEST 2011


On Mon, 25 Apr 2011 21:14:51 +0100, Hans Georg Schaathun
  <hg at schaathun.net> wrote:
: :  The way you talk of "the" external interface, I'm assuming this
: :  computer has only one. Is there a reason for not simply binding to
: :  INADDR_ANY aka 0.0.0.0?
: 
:  Ah.  That's what I really wanted.  Thanks a lot.  I wonder why that
:  was not mentioned in the tutorial I used ...

Hmmm.  socket.INADDR_ANY is an integer and bind insists on a string
for the hostname (Python 2.6).  Is there any use for the integer
constant?  "0.0.0.0" does exactly what I wanted though.  Thanks again.

-- 
:-- Hans Georg



More information about the Python-list mailing list