lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Mike Pall wrote:

You need a specific order of actions for Windows:
1. Create UDP socket
2. Set SO_REUSEADDR option
3. Bind addr = INADDR_ANY, port = multicast-port
4. IP_ADD_MEMBERSHIP multiaddr = multicast-group

Exactly what I'm doing. Within a single app - no problem, I can bind as many
sockets (at least 3) exactly as documented.

The second copy of the app fails on bind().

See:
  http://msdn.microsoft.com/en-us/library/ms740621(VS.85).aspx
  http://support.microsoft.com/default.aspx?scid=kb;en-us;131978

--Mike


Having read that ms stuff yet again, it would appear that the behaviour
depends on
a/ whether the first socket sets so_reuseaddr or not
b/ whether the listener is bound to a wildcard address (which is recommended
for udp multi).

I can try first binding without reuseaddr, then retry with reuseaddr if the
first bind returns "INUSE";
also bind to the local multicast i/f rather than INADDR_ANY.

But not tonight.
Thanks

Adrian