What strings should be used in the join_multicast_group function?

Godot Version

4.2

Question

I am trying to setup a multicast listener for a ‘beacon’ that is broadcast every second on a specific port. Once I find that ‘beacon’ in contains the IP address of the broadcasting machine that I can use for UDP communication.

I’m having a problem understanding the join_multicast_group(multicast_address, interface_name) function. The documentation states: Joins the multicast group specified by multicast_address using the interface identified by interface_name .I have used IP.get_local_interfaces() which returns a dictionary of 13 items. However, interface_name is looking for a string. Should the string be ‘name’, ‘friendly’, ‘index’, ‘address’ or some other value like ‘ANY’? Is the multicast address the PORT number, or an IP address or something else?

A good example would be helpful, but I’ve been unable to find an example with my google searches.

https://www.reddit.com/r/godot/comments/kqyepv/cant_figure_out_multicast/

1 Like

Thanks for the example. I will be exporting to an iPhone IOS device and I’m hoping to prevent the users of the app from manually entering an IP address. I’ve been working with C# networking for the past couple of weeks, but don’t yet have the communication issues resolved.