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

Irmen de Jong irmen at -NOSPAM-REMOVE-THIS-xs4all.nl
Sun Feb 16 19:22:55 CET 2003


Irmen de Jong wrote:

> I will try to hack together a quick C program that calls
> the bsd (actually winsock) API directly and see what that
> does with different bind addresses under windows.

The results of this are that binding on INADDR_ANY ('') works,
and binding on INADDR_BROADCAST ('255.255.255.255' or
'<broadcast>') fails with a winsock error "cannot assign
requested address".

So I will add the following check:
if running windows --> use ''
otherwise --> use '<broadcast>'

Weird.

Irmen





More information about the Python-list mailing list