[erlang-questions] UDP Multicast - how does it work?
Mon Apr 11 10:58:43 CEST 2016
> Step 1) Reach several processes on the same machine with one send.
UDP Multicast works as a part of the link layer ( as in MAC - Media Access Control*), and as such appears to a process on the machine as a "normal" UDP traffic.
Although I've heard that some operating systems may have provide variants that allow multiple OS processes to use to the same UDP port (and hence receive the same multicast packet), I doubt t you'd be able to accomplish this in Erlang.
> Step 2) Reach several processes on possibly different machines with one send.
I think this would be possible if you rephrase your requirement to something like this: " Reach several machines with a single send". As for reaching several processes on the same machine, see comment for Step 1).
(*) In a nutshell, the multicast address you specify is just used to set four (out of six) octets of the interface's MAC address to that value. In other words, it will add another link (MAC) address to your physical interface.
When any given interface sends to a multicast group (so called class D address), instead of using ARP to obtain destination's link address, the driver will simply combine given multicast address with predefined destination (e.g. multicast) address.
Conversely, when a multicast packet is received by the interface that is subscribed to the given multicast address, it will accept the packet and forwarded it to the UDP port (and hence OS process) referenced by the received packet.
More information about the erlang-questions