-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Milestone
Description
IP multicast allows sending a single datagram to multiple receivers simultaneously at the network level — the OS/network handles fan-out instead of the application. Essential for service discovery, real-time data feeds, and LAN gaming.
Depends on #16 (StormUdpServer) and #17 (StormUdpClient).
Proposed API
Server — multicast send:
var udp = new StormUdpServer(new UdpServerOptions
{
EndPoint = new IPEndPoint(IPAddress.Any, 9000),
});
await udp.StartAsync();
// Send to multicast group (network-level fan-out)
await udp.MulticastAsync(
new IPEndPoint(IPAddress.Parse("239.255.0.1"), 9000), data);Client — multicast receive:
var client = new StormUdpClient(new UdpClientOptions
{
EndPoint = new IPEndPoint(IPAddress.Any, 9000),
ReuseAddress = true,
});
client.OnDataReceived += async data =>
{
Console.WriteLine($"Multicast: {data.Length} bytes");
};
await client.StartAsync();
client.JoinMulticastGroup(IPAddress.Parse("239.255.0.1"));
// Later
client.LeaveMulticastGroup(IPAddress.Parse("239.255.0.1"));Notes
- IPv4:
SocketOptionLevel.IP+MulticastOption - IPv6:
SocketOptionLevel.IPv6+IPv6MulticastOption ReuseAddress = truerequired for multiple receivers on same port- Server
MulticastAsyncis a convenience overSendToAsyncwith a multicast address - Could integrate with StormSocket Groups in the future:
server.Groups.JoinMulticast("239.255.0.1:9000")— but keep it simple first
Reactions are currently unavailable