I have seen this thread but I don't think it really solves my concern: UDP broadcasting in netty 4.x.x
My question is is it possible to send a broadcast UDP packet to a number of different addresses at once? In TCP I was able to call write on a channel group, but in UDP, everything flows through a single channel* (*correct me if I'm wrong here as well).
Because of the single channel I must write each packet separately with it's own recipient. Right now I'm just going through a loop of each of my addresses and sending a packet... it seems inefficient.
Is there a better way to do this?
IP multicast might be what you're looking for. You don't need any special language framework support to use it. Your peers join a multicast 'group' and you send datagrams to the group and all peers will receive them. A 'group' in this context is just an IP address from one of the multicast ranges.
This will generally work reliably on a single subnet and can be made to work well if you're in control of the routers and firewalls in your organisation that connect subnets together. It is common to find that firewalls block multicast by default and routers have to be configured to route multicast traffic between subnets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With