lua-users home
lua-l archive

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


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
> MSDN:
> 
> http://support.microsoft.com/kb/257460/en
> 
> 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 http://www.sockets.com/ch16.htm#Multicast

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.

Tim