I use NSNetService and NSNetServiceBrowser to publish and test Bonjour services on the network. The implementation works fine, the services are online, and they are able to communicate. I am currently trying to understand the life cycle of a structure and this is what I still have:
This happens if I start the services with the adapter turned on. Now I need to know if the advertisement is constantly being actively advertised on the network; that is, if other devices are able to find it. Therefore, I am testing it by disconnecting the Wi-Fi adapter:
netServiceBrowser:didRemoveService:moreComing: netServiceBrowser:didFindService:moreComing:
Then turn on the adapter again:
netServiceBrowser:didRemoveService:moreComing: netServiceBrowser:didFindService:moreComing:
The problem is that there is no difference in turning the adapter on or off, so I cannot look for a template. Is there any other way I can catch these events?
Edit: everything is getting worse. Even if I start the services with the adapters disabled (airplane mode), netServiceDidPublish: is still called. It still seems that netServiceDidNotPublish: is only called when I try to register the same service twice. This is very controversial for me; the service may have been published on the adapter, but not on the network, and therefore such callbacks are very misleading. At the moment, I can’t find out if the service is visible on the network.
source share