I am working with the NetworkServiceDiscovery class. I am utilizing the class so I generate an instance of an Advertiser and an instance of an AvailableServiceList. I initialize both in my class constructor with the matching SUD as first param, and matching broadcast ports.
I run this same application on 2 instances of Windows machines, however it would appear that the AvailableServiceList instance is not picking up any of the broadcasted messages sent from the Advertiser instance.
To clarify, I have paused the debugger and confirmed both threads are active, the AvailableServiceList instance seems to be waiting on ready. I have also confirmed the broadcast port is not blocked on Windows. I have also confirmed via Wireshark that UDP packets are making their way through.
Does anyone have any ideas? Or anything I could be missing?
@thomash1 did you find a solution on this? It seems I have the same issues on macOS. It used to work since a few months ago. I didn’t touch the code but it doesn’t work anymore.
I haven’t tested it myself, but I wonder whether the Networking entitlement is now required on Big Sur. The doc text just mentions iOS, but the “Availability” section lists macOS 11.0+.
There’s an option to enable this in the Projucer. You could try setting it and see whether it helps.
okay, did some further tests. It was not a network entitlement issue. But I found a solution.
Before, I instantiated a NetworkServiceDiscovery::AvailableServiceList object in a class method and immediately called getServices() That seems to be too fast to show any results. However, if I create a class variable on the stack or create a global singelton it’s working fine. I still can’t figure out why it worked before …
The service discovery classes depend on juce::IPAddress::getInterfaceBroadcastAddress(), which remains unimplemented for Windows (juce_win32_Network.cpp):
These classes in my opinion should just use the ZeroConfig protocol.
The protocol is very powerful and is used by many applications and also by OSX itself.
It is especially useful if you want to publish a service other applications are allowed to tap into.
Having a nice wrapper around it in JUCE would be very convenient.