lua-users home
lua-l archive

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

Date: Wed, 13 Aug 2003 15:47:33 -0400 (EDT)
From: Diego Nehab <diego@CS.Princeton.EDU>
To: Lua list <>
Subject: Re: Lua Sockets (multicast stuff)


> For this, I need two features in the UDP class in Lua Sockets:
>   -- Multicast support
>   -- An option to set TTL

There are a bunch of socket options to control multicast.  They are all
IP options, I think (man IP). It looks like it is the same for winsock
and bsd sockets.  If it is just socket options, than it should be easy
to add these to the udp.c module (or perhaps the inet.c module).

Which options you would need? You can ago ahead and add them yourself
so that you can play with it, since I am only releasing another version
of LuaSocket when the manual is ready. Something like the following would
look like LuaSocket code:

    udp = socket.udp()
    udp:setsockname("*", PORT)
    udp:setoption("ip-multicast-ttl", NHOPS)
    udp:setoption("ip-multicast-loop", false)
    udp:setoption("ip-add-membership", {
        interface = "*",
        group = GROUP,   -- "", for example
    receive stuff from multicast
    udp:setoption("ip-drop-membership", {
        interface = "*",
        group = GROUP,

> Is this a reasonable request or should I slug it out and then submit a
> patch?

I added the other options because someone requested it for use with the
ARP protocol. I don't see why not add these other options if they work on
all platforms that I compile LuaSocket on. Feel free to send me a patch,
if you have one.