Issues with Multicast Operations using NWConnectionGroup and NWMulticastGroup

Hello,

I've been encountering some challenges while working with NWConnectionGroup and NWMulticastGroup for multicast operations on iOS. I have a few doubts and issues that I would like to address:

1. NWMulticastGroup Initialization

It seems that when initializing NWMulticastGroup, only one NWEndpoint can be passed, and attempting to pass multiple endpoints results in failure. Can someone confirm if this behavior is correct?

2. Interface Level Control

Upon initializing NWConnectionGroup, it appears that packets are received on all interfaces without the ability to control this at the interface level. Is this correct? If not is there a way to configure NWConnectionGroup to receive packets on all interfaces?

3. Sending Behavior

During the send operation, it appears that the data is sent through any one of the available interfaces, and there doesn't seem to be an option to configure it to send through all available endpoints. Is there a way to enable sending data through all available endpoints?

Any insights, guidance, or solutions to these issues would be greatly appreciated. Has anyone else encountered similar problems or found workarounds for these limitations?

Thank you for your assistance and support.

Thanks,

Harshal

Sorry that I didn’t respond earlier. I somehow missed this back in May.

It seems that when initializing NWMulticastGroup, only one NWEndpoint can be passed, and attempting to pass multiple endpoints results in failure. Can someone confirm if this behavior is correct?

Correct.

Upon initializing NWConnectionGroup, it appears that packets are received on all interfaces without the ability to control this at the interface level. Is this correct?

Correct.

With regards this and the sending behaviour, the way I deal with this in BSD Sockets is to create one socket per (appropriate) interface, binding it to that interface with IP[6]_BOUND_IF. So:

  • On receive, the socket indicates which interface the datagram came from.

  • On send, I write to the socket for the target interface.

I’ve always presumed that this would work the same way with Network framework, substituting the requiredInterface property for IP[6]_BOUND_IF. However, I’ve never actually tried it.

I recommend that you give it a whirl and see how it behaves.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Issues with Multicast Operations using NWConnectionGroup and NWMulticastGroup
 
 
Q