# NetworkServiceDiscovery Issue

**URL:** https://forum.juce.com/t/networkservicediscovery-issue/47180
**Category:** Windows
**Created:** [August 3, 2021, 3:31pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180 "2021-08-03T15:31:36Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![thomash1](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@thomash1](https://forum.juce.com/u/thomash1)
#### Post date: [August 3, 2021, 3:31pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/1 "2021-08-03T15:31:36Z")

</div>

Hello Juce friends,

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?

Thankyou

Tom

---

<div class="post-metadata">

### Author: ![StefanS](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@StefanS](https://forum.juce.com/u/StefanS)
#### Post date: [February 7, 2022, 7:59pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/2 "2022-02-07T19:59:54Z")

</div>

Hi,

@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.

thanks  
Stefan

---

<div class="post-metadata">

### Author: ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)
#### Post date: [February 8, 2022, 11:11am UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/3 "2022-02-08T11:11:07Z")

</div>

Did you update your version of macOS in the meantime?

---

<div class="post-metadata">

### Author: ![StefanS](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@StefanS](https://forum.juce.com/u/StefanS)
#### Post date: [February 8, 2022, 8:34pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/4 "2022-02-08T20:34:56Z")

</div>

Yes indeed, I switched to Big Sur and was on Mojave before.

---

<div class="post-metadata">

### Author: ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)
#### Post date: [February 8, 2022, 9:11pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/5 "2022-02-08T21:11:56Z")

</div>

I haven’t tested it myself, but I wonder whether the [Networking entitlement](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_multicast?language=objc) 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.

---

<div class="post-metadata">

### Author: ![StefanS](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@StefanS](https://forum.juce.com/u/StefanS)
#### Post date: [February 8, 2022, 9:59pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/6 "2022-02-08T21:59:29Z")

</div>

yeah good point. I will try that tomorrow and report.

however, I also use InterProcessCommunication between my Plugin and App and that is still working without any problems.

Thanks Reuk

---

<div class="post-metadata">

### Author: ![StefanS](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@StefanS](https://forum.juce.com/u/StefanS)
#### Post date: [February 10, 2022, 4:16pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/7 "2022-02-10T16:16:46Z")

</div>

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 …

---

<div class="post-metadata">

### Author: ![getdunne](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/getdunne/32/2712_2.png) [@getdunne](https://forum.juce.com/u/getdunne)
#### Post date: [April 2, 2022, 2:27pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/8 "2022-04-02T14:27:55Z")

</div>

The service discovery classes depend on juce::IPAddress::getInterfaceBroadcastAddress(), which remains unimplemented for Windows (juce\_win32\_Network.cpp):

```auto
IPAddress IPAddress::getInterfaceBroadcastAddress (const IPAddress& address)
{
    // TODO
    return {};
}

```

This simple-minded implementation works:

```auto
IPAddress IPAddress::getInterfaceBroadcastAddress (const IPAddress& address)
{
    if (address.isIPv6)
        // TODO
        return {};

    String broadcastAddress = address.toString().upToLastOccurrenceOf(".", true, false) + "255";
    return IPAddress(broadcastAddress);
}

```

---

<div class="post-metadata">

### Author: ![rebbur](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rebbur](https://forum.juce.com/u/rebbur)
#### Post date: [April 7, 2022, 7:35am UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/9 "2022-04-07T07:35:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![chorton](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@chorton](https://forum.juce.com/u/chorton)
#### Post date: [June 29, 2024, 4:45pm UTC](https://forum.juce.com/t/networkservicediscovery-issue/47180/10 "2024-06-29T16:45:21Z")

</div>

I’ve just been implementing a similar application where I am connecting machines together across the network, and noticed that the Advertiser class indeed wasn’t broadcasting on Windows. I checked this fix and indeed the IPAddress::getInterfaceBroadcastAddress is still empty, and this fix worked first time.

Is there any chance this could be added to the official JUCE code?
