[Nottingham] Easy linux network multicast?

Cam camilo at mesias.co.uk
Tue May 16 17:25:05 BST 2006


Charles / list

> For true multicast, there's a few things you need to know about:
> - you need to set up a specific route on the "multicast network"

True, if you're on the internet. On a LAN it will probably just work 
(barring the effects of routers and firewalls).

> - you send to the multicast address, not the recipients' address or a 
> broadcast address

Something like 224.0.0.1 should work. See here for more info:
http://www.iana.org/assignments/multicast-addresses

> - you need to "subscribe" as such:

I thought the kernel did most of the work for you if you opened a socket 
listening to a MC address?

> You'll probably need to write code to use multicast or broadcast unless you 
> can find something on the 'net.

Just for fun, you can do this with netcat. You'll need several machines 
(well at least two). Here's an example. I use port 9099:

On the clients type:

nc -u -l -p 9099

(ie. UDP mode listen on port 9099)

On the server type:

nc -u 224.0.0.1 9099 < /etc/hosts

(ie. UDP mode send stdin to 224.0.0.1 port 9099)

You can have as many clients as you want listening to the single 
multicast. If you have tcpdump you can investigate the difference 
between multicast and broadcast, and see the work the kernel is doing 
for you...

netcat is a lot of fun, in a bored moment you could implement a chat 
service or the like.

(hope someone found that interesting!)

-Cam
-- 
camilo at mesias.co.uk                                                 <--



More information about the Nottingham mailing list