Is there any advantage to using a multicast group to send messages rather than just broadcasting them to a specific port? I understand that when broadcasting, other computers that don't want the messages receive them too, but how much does it affect performance/traffic? Don't the computers that don't care just dump the message immediately?
As a side question, does multicast outside the LAN work at all?
I will assume you're talking about IP traffic. When you say LAN, I will assume you mean an ethernet topology inside an office building (I will be more specific about topologies below).
Multicast should be used when broadcasting isn't good enough. That sounds like a snark, but in reality it's the best way to answer the question... there are many reasons why people might want multicast instead of broadcast...
- Multicast doesn't consume CPU and bandwidth resources when it isn't required. Depending on how much broadcast you send, that may or may not be meaningful to the parties involved. However, broadcast traffic will always consume bandwidth for every device in a Vlan
- Multicast traffic can be pruned inside a single switched ethernet Vlan / broadcast domain, broadcasts by-definition can't be pruned within a broadcast domain.
- Medium and large office building LANs usually have maybe 5 or 10 Vlans for perhaps 300 people. A Vlan is a way of defining a boundary on broadcast domains. Multicast traffic and topologies can be designed so this traffic reliably crosses ethernet broadcast domains; it's not a good idea to forward any real volume of broadcast traffic across multiple broadcast domains. You often find multiple Vlans or broadcast domains in office buildings with as few as 40 people.
- Closely related to the point above, IP multicast traffic can be sent across a Wide Area Network.
- Multicast should be used instead of broadcast traffic if the customers who pay your salary are dogmatic about it
There are several reasons you might want to use Broadcast traffic instead of multicast traffic...
- Your application's traffic volume is very low, and limited to a single Vlan
- You think the target audience is too cheap to pay for the incremental staffing and IT infrastructure to do multicast correctly (IP multicast requirements are much more detailed than simple IP unicast/broadcast traffic)
- If you haven't configured your infrastructure correctly, (as a general rule) IP multicast is treated just like broadcast traffic. Multicast requirements add time / cost to any application deployment timelines
- The software developer otherwise doesn't want to invest the time and energy wrestling with various host OS IGMP stacks and other multicast infrastructure complications