Hello,
i want to find all open mDNS services with the new NWBrowser. With the NetServiceBrowser i got all Services by searching for this type: "_services._dns-sd._udp." but with the NWBrowser i dont get anything. if i search for a specific type like http or companion link i find some devices. How can i get all services with the NWBrowser ? Or is this not possible due to new data collection guidelines ? I tried it in a Playground
import Network
let parameter = NWParameters()
parameter.includePeerToPeer = true
let browser = NWBrowser(for: .bonjour(type: "_services._dns-sd._udp.", domain: nil), using: parameter)
browser.stateUpdateHandler = { state in
switch state {
case .ready:
print("ready")
case .failed(let error):
print("error:", error.localizedDescription)
default:
break
}
}
browser.browseResultsChangedHandler = { result, changed in
result.forEach { device in
print(device.endpoint)
print(device.metadata)
}
}
browser.start(queue: .main)
PlaygroundPage.current.needsIndefiniteExecution = true