views:

302

answers:

1

I have an array of IP addresses, and I want to send the same data to all of them. I could just send the loop code that sends data but I think there's a better way of doing this.

I've heard of multicast, what exactly is it? I think it's what I need but how do i use it.

A: 

Yes, you can use multicast for this. Your sender just emits UDP packets to any address in the 224.x.x.x to 239.x.x.x range. Your receivers listen on the same address, and the underlying stack and network fabric figure out how to get the packets from sender to receiver.

Beware that this range is subdivided so that certain addresses will be more appropriate to your application than others. You might choose 239.x.x.x for a program that's only used on a single LAN, for instance.

Also beware that this only works with UDP -- there's no such thing as multicast TCP -- and that getting it to work across routers may be difficult. Getting it to work across the current Internet is especially difficult, since most ISPs don't support multicast.

Warren Young
I forgot to say I'm only using it for a local network, which has a switch and a router.Do you have a links to examples/tutorials for multicast?
Jonathan