lua-users home
lua-l archive

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

I would like to come back to this issue. In the meanwhile I have tested the same script
in the following environments. The behavior of the call
	udp:setoption("ip-add-membership", "")
is as follows:

1. QNX: setoption(...) works and multicast reception as well
2. Lua For Windows: setoption(...) fails
3. Cygwin: setoption(...) works and multicast reception as well

My feeling is that cygwin uses the correct header/library combination.

So my question to the developers for Windows would be to investigate this issue in
their source code environment and hopefuly be able to fix this problem.

Thanks a lot

Tim Channon schrieb:
Herbert Leuwer wrote:
I tried to add multicast membership to a datagram socket for IP
multicast using udp:setoption(...), but the call allways fails.
After some browsing I found a possible cause related to this article of

Looking into the original luasocket code, I found that luasocket seems
to use winsock.h while clibs\socket\core.dll seems to be linked against
ws2_32.lib. This would be the non-tolerant header/lib combination named
in the article above.

The same Lua receive script works fine in a non-Windows environment.

Sending of multicast packets works also in Windows.

I used the latest Lua for Windows version.

Looks like a long story, is about a change in the specification on
multicast. Berkeley changed but the older Steve Deering definitions
stayed in winsock 1 API.
Try this

Changed luasocket.h to include winsock2.h

Compile fails on multicast Lua code.

Do as the Microsoft doc you cite says, fragment of Luasocket.h follows
and is linked with ws2_32

* WinSock include files
#include <winsock2.h> /*TNC changed from winsock.h */
#include <Ws2tcpip.h> /*TNC added */

typedef int socklen_t;
typedef SOCKET t_socket;
typedef t_socket *p_socket;

And compiles fine. I do not know whether this fixes things.