[erlang-questions] UDP Multicast - how does it work?

Oliver Korpilla Oliver.Korpilla@REDACTED
Mon Apr 11 11:19:00 CEST 2016

Hello, Valentin.

That's the thing, though. I read through as many posts I can find and it seems like {reuseaddr, <bool>} is... behaving differently on Erlang than with other languages on same OS.

I'm not fixed to UDP Multicast to solve my problem. Any solution would do. But it seems that the above construct really *is* a problem.

I've seen references that multiple UDP sockets bound to the same port work in other languages on the same OS but somehow they might not in Erlang. I found no followup to this:


Maybe I'm misunderstanding something here.

Things I could live with:
* Addressing a range of ports or all ports on same machine in one send.
* Several processes listening on the same port on the same machine.

What I want to avoid is to send multiple messages, that's all. I want to address several clients in one machine with one send without previously knowing how many there are.

Thanks and kind regards,

Gesendet: Montag, 11. April 2016 um 10:58 Uhr
Von: "Valentin Micic" <valentin@REDACTED>
An: "Oliver Korpilla" <Oliver.Korpilla@REDACTED>
Cc: erlang-questions@REDACTED
Betreff: Re: [erlang-questions] UDP Multicast - how does it work?
> 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).

Kind regards


(*) 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 mailing list