Scanning for local servers, getting a broadcast address

Peter Hansen peter at engcorp.com
Mon Jun 9 21:28:02 EDT 2003


Irmen de Jong wrote:
> 
> Noah wrote:
> > Ah, yes, of course. But I did not know that you could use
> > '<broadcast>' for the bind side. Does that tell it to
> > listen on all available interfaces?
> 
> Well, in my opinion, it should. The problem is that certain
> OS-ses (windows, mac os X) with certain Python implementations
> decide otherwise, and return an error ("cannot assign requested
> address" or such). In that case, '' usually *does* work.
> Binding on the ip address always works, but you'll only get
> broadcast packets that are sent to *that* adapter.

Binding on the ip address doesn't even let you get packets
that are sent from localhost (127.0.0.1), as far as I know,
making some kinds of troubleshooting quite difficult.  I
believe binding to '' is not just a "usually" working 
solution, but the _correct_ method of listening on all
interfaces.  (And listening on fewer than all is perhaps
best handled with a firewall, if security is the rationale.)

-Peter




More information about the Python-list mailing list