Broadcast socket bind on Windows; '<broadcast>' or ''

Irmen de Jong irmen at -NOSPAM-REMOVE-THIS-xs4all.nl
Sat Feb 15 19:41:14 EST 2003


Hi

When trying to bind a UDP socket on Windows, I get this:

 >>> s=socket(AF_INET, SOCK_DGRAM)
 >>> s.bind(('<broadcast>', 9092))
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
   File "<string>", line 1, in bind
error: (10049, "Can't assign requested address")

When using '' as hostname in the bind call, it works nicely.

What's going on?

The bind with '<broadcast>' works under Linux,
and seems to be necessary instead of '', because
else broadcast packets might not be received from
different network adapters.

Is windows different here? Why doesn't '<broadcast>' work?

Irmen de Jong.





More information about the Python-list mailing list