Bonjour service is not discoverable

I am building app for MacOS to advertise using bonjour but non of the other mDNS is able to resolve service.

I have added Privacy - Local Network Usage Description to plist. I have added BonjourServices like this:

  • _myservice._tcp.local.
  • _myservice._tcp.

I was trying to use both NetService as well as NWListener.Service with the same result.

It only publishes type and no other informations. I tried other implementations of mDNS. I tried java and android and both works as expected and works fine except they can't find NetService event through NetService can find them.

I feel like I looked up whole internet already with no luck.

I also tried to use dns-sd tool to discover more and it does find them but with interesting results, because it returns -1 interface.

What else can I try?

edit. I have more insights. I can't event properly register service using dns-sd on my macbook with Big Sur but on my partners with Catalina no problem everything works as expected.

OK, let’s try a basic test using dns-sd:

  1. On the macOS 11 machine having problems, register a service:

    % dns-sd -R Slimey _myservice._tcp. local. 12345
    Registering Service Slimey._myservice._tcp..local. port 12345
    DATE: ---Mon 16 Aug 2021---
    10:01:52.024  ...STARTING...
    10:01:52.675  Got a reply for service Slimey._myservice._tcp.local.: Name now registered and active
    ^C
    
  2. On another Mac on the same network, start a browse for that service:

    $ dns-sd -B _myservice._tcp. local.
    Browsing for _myservice._tcp..local.
    DATE: ---Mon 16 Aug 2021---
    10:01:21.695  ...STARTING...
    Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
    10:01:53.130  Add        2   4 local.               _myservice._tcp.     Slimey
    
  3. Does it see the service from step 1? If so, try doing a resolve:

    ^C
    $ dns-sd -L Slimey _myservice._tcp. local.
    Lookup Slimey._myservice._tcp..local.
    DATE: ---Mon 16 Aug 2021---
    10:02:10.386  ...STARTING...
    10:02:10.387  Slimey._myservice._tcp.local. can be reached at Slimey.local.:12345 (interface 4)
    ^C
    

    What do you see?

Share and Enjoy

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

Thanks for reply. So when I run your test. Mac A (11.5.1 (20G80))

> dns-sd -R Slimey _myservice._tcp. local. 12345
Registering Service Slimey._myservice._tcp..local. port 12345
DATE: ---Mon 16 Aug 2021---
19:21:20.417  ...STARTING...
19:21:20.417  Got a reply for service Slimey._myservice._tcp.local.: Name now registered and active

on Mac B (10.15.7)

~ % dns-sd -B _myservice._tcp. local.

Browsing for _myservice._tcp..local.
DATE: ---Mon 16 Aug 2021---
19:26:36.227  ...STARTING...

So no luck.

When I run it on the same Mac A I get this:

> dns-sd -B _myservice._tcp. local.
Browsing for _myservice._tcp..local.
DATE: ---Mon 16 Aug 2021---
19:23:41.566  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
19:23:41.567  Add        2  -1 local.               _myservice._tcp.     Slimey

Now I will try register on Mac B and browse on Mac A.

Mac B:

~ % dns-sd -R Slimey _myservice._tcp. local. 12345 

Registering Service Slimey._myservice._tcp..local. port 12345
DATE: ---Mon 16 Aug 2021---
19:29:26.004  ...STARTING...
19:29:26.646  Got a reply for service Slimey._myservice._tcp.local.: Name now registered and active

And while keep listening on Mac A I got:

> dns-sd -B _myservice._tcp. local.
Browsing for _myservice._tcp..local.
DATE: ---Mon 16 Aug 2021---
19:23:41.566  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
19:23:41.567  Add        2  -1 local.               _myservice._tcp.     Slimey
19:29:26.833  Add        2   5 local.               _myservice._tcp.     Slimey

I let my friends run similar tests before on Big Sur and it worked for them so I am think it's very likely it's my machine only.

I just notice there is an update available to 11.5.2. Will run the update and try again. Might take a while.

edit Mac A

> dns-sd -V
Currently running daemon (system service) is version 1311.40.1

I am think it's very likely it's my machine only.

Yep. There’s three potential causes for this:

  • Mac B is not browsing properly.

  • Mac A is not responding to browse requests.

  • Something on your network is messing this up.

I think we can rule out the first possibility, because you said that it’s not just Mac B that can’t see Mac A’s service.

To rule out the last possibility I recommend that you attach the Macs directly via Ethernet. That is, turn off Wi-Fi on both Macs and then connect an Ethernet cable directly from A to B. Once you do that, does the dns-sd test still fail?

Share and Enjoy

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

Bonjour service is not discoverable
 
 
Q