[PLUG] LAN broadcast?

Tim tim-pdxlug at sentinelchicken.org
Thu Jun 2 13:51:01 UTC 2011


Wayne,

> Not surprised. I couldn't see a way to broadcast using SOCK_STREAM. 
> Googled all over trying to find an example. Does it follow that since I 
> would like to use SOCK_STREAM for the rest of the communications during 
> the optimization job, the multicast side would need to be on a second 
> network interface?

Honestly, I've never implemented anything with multicast.  It is just
a neat way to efficiently distribute traffic.  

I've done a little digging, since this is something I want to learn as
well, and I believe you just need to set some socket options which
instruct the kernel which multicast groups you want to subscribe to.
Then in the background the kernel will notify the appropriate routers
what group traffic you should receive, etc.  I'm a little fuzzy on
what group you would want to pick for simple local experiments...

In any case, it shouldn't require using a different interface.  You
just subscribe to and then bind to a multicast group address and then
receive datagrams on that socket.  Separate unicast sockets can be
used on the same interface.

Here's a few links I found helpful:
  http://www.inetdaemon.com/tutorials/internet/igmp/
  http://www.ibiblio.org/pub/linux/docs/HOWTO/other-formats/html_single/Multicast-HOWTO.html#ss6.4
  http://www.cs.wpi.edu/~claypool/courses/4514-B99/samples/multicast.c
  

tim



More information about the PLUG mailing list