Bonjour, also known as zero-configuration networking, enables automatic discovery of devices and services on a local network using industry standard.

Posts under Bonjour tag

49 Posts
Sort by:
Post marked as solved
2 Replies
452 Views
I’m, using NSNetService in macOS & iOS to advertise a network service that is written in a cross-platform way using C++. Using the new Network framework, advertising via NWListener.Service seems only possible if the network interface is also written using NWListener. How can I advertise my network service via Bonjour without using the now deprecated NSNetService? Thanks for any advise.
Posted
by
Post not yet marked as solved
3 Replies
503 Views
Hello everyone. I made a minimal example with DNS proxy. It works well on iOS 12, and doesn't work on iOS 14 (proxy runs well, but websites don't load). Traffic on iOS 14: 2 DNS queries (type A and type 65) + 2 successful DNS responses and it's all (there are no more IP packets). DoH / DoT are disabled. In logs everything is OK (no errors, everywhere are the same number of packets (read from NEAppProxyUDPFlow = sent to NWConnection = received from NWConnection = written to NEAppProxyUDPFlow). There are no TCP connections. Thanks in advance for any ideas / suggestions. import NetworkExtension //import DNS class DNSProxyProvider: NEDNSProxyProvider {       override init() {     super.init()   }   override func startProxy(options: [String: Any]? = nil,                completionHandler: @escaping (Error?) -> Void) {     completionHandler(nil)   }   override func stopProxy(with reason: NEProviderStopReason,               completionHandler: @escaping () -> Void) {     completionHandler()   }   override func sleep(completionHandler: @escaping () -> Void) {     completionHandler()   }   override func wake() {}       override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {     if let tcpFlow = flow as? NEAppProxyTCPFlow {       NSLog("MyDebug: TCP connection")     } else if let udpFlow = flow as? NEAppProxyUDPFlow {       NSLog("MyDebug: UDP connection")       establishConnection(flow: udpFlow)       openFlow(flow: udpFlow)     }     return true   }   private func openFlow(flow: NEAppProxyUDPFlow) {     flow.open(withLocalEndpoint: nil) { opnErr in       if let e = opnErr {         NSLog("MyDebug: open error - \(e.localizedDescription)")       } else {         NSLog("MyDebug: open - ok")       }     }   }       private func establishConnection(flow: NEAppProxyUDPFlow) {     let conn = NWConnection(host: "8.8.8.8", port: 53, using: .udp)     conn.stateUpdateHandler = { state in       switch state {       case .ready:         NSLog("MyDebug: establishConnection ready")         self.send(flow: flow, connection: conn)       case .setup:         NSLog("MyDebug: establishConnection setup")       case .cancelled:         NSLog("MyDebug: establishConnection cancelled")       case .preparing:         NSLog("MyDebug: establishConnection preparing")       default:         NSLog("MyDebug: establishConnection default")       }     }     conn.start(queue: .global())   }       private func send(flow: NEAppProxyUDPFlow,            connection conn: NWConnection) {     flow.readDatagrams { (datagrams, endpoints, rdErr) in       let datas = self.extractReadData(rdErr: rdErr, datagrams: datagrams)       for packet in datas {         conn.send(content: packet,              completion: .contentProcessed( { sndErr in               if let e = sndErr {                 NSLog("MyDebug: send error - \(e.localizedDescription)")               } else {                 NSLog("MyDebug: send - ok")                 self.receive(flow: flow, connection: conn)               }         }))       }     }   }       private func extractReadData(rdErr: Error?,                  datagrams: [Data]?) -> [Data] {     if rdErr == nil, let datas = datagrams, !datas.isEmpty {       NSLog("MyDebug: read - ok")       return datas     } else {       if let e = rdErr {         NSLog("MyDebug: read error - \(e.localizedDescription)")       } else {         NSLog("MyDebug: read - datagrams is empty or null")       }       return []     }   }       private func receive(flow: NEAppProxyUDPFlow,              connection conn: NWConnection) {     conn.receiveMessage { (data, context, isComplete, rcvErr) in       let d = self.extractReceivedData(data: data, isComplete: isComplete, rcvErr: rcvErr)               flow.writeDatagrams([d], sentBy: [flow.localEndpoint!]) { wrtErr in         if let e = wrtErr {           NSLog("MyDebug: write error - \(e.localizedDescription)")         } else {           NSLog("MyDebug: write - ok")         }       }     }   }       private func extractReceivedData(data: Data?,                    isComplete: Bool,                    rcvErr: NWError?) -> Data {     if isComplete, rcvErr == nil, let d = data {       NSLog("MyDebug: receive - ok")       return d     } else {       if let e = rcvErr {         NSLog("MyDebug: receive error - \(e.localizedDescription)")       } else {         NSLog("MyDebug: receive - isComplete = \(isComplete); data = \(data)")       }       return Data()     }   } }
Posted
by
Post not yet marked as solved
2 Replies
562 Views
Hello, I am trying to write an iOS app which could receive and analyze mDNS queries. More specifically, I have my app register a Bonjour service, and I need to see queries from the network for any subtype of my primary type, although I have not registered any subtype myself. Reason being that I have a device that tries to find me using a specific primary type, but always includes a subtype in its queries, and I can't know the subtype in advance, so I can't register my service with the subtype. So I'd need to see the query, extract the subtype and re-register my service with that subtype so that the device can then find me. Looks like the various APIs to interact with Bonjour won't let me do that. I've tried another approach and started a NWListener on port 5353 with allowLocalEndpointReuse set to true, but I'm getting "Address already in use" and it doesn't work, since this port is likely to be used by the mDNSresponder service. Is there an API I could use to achieve what I described above ?
Posted
by
Post not yet marked as solved
3 Replies
391 Views
I am able to send json data between NWConnection and NW Listener. I need help to send photo or any file to each other. I am using TCP protocol for data transfer. Please let me know how can I send any file. Thank You
Posted
by
Post marked as solved
2 Replies
355 Views
My company's app uses the following code to look for services advertised by a Garmin VIRB 360 camera (now discontinued and unsupported). In the past this code has worked fine. However, on my iPhone 12 Pro Max running iOS 15.0.2 it returns no services. let serviceBrowser = NetServiceBrowser() serviceBrowser.searchForServices(ofType: "_garmin-virb._tcp.", inDomain: "local.") Did something change in iOS 15? Do I need some entitlement? Is the format of the strings incorrect? My recollection is that the strings are from Garmin document (but its years old). Any help greatly appreciated!
Posted
by
Post not yet marked as solved
0 Replies
238 Views
Hi Does anyone know what the Bonjour service that advertises mirror.dca.local is used for ? I upgraded from 14.4 to 14.7.1 and see that my phone is broadcasting this using multicastDNS / Bonjour. Merci beaucoup
Posted
by
Post not yet marked as solved
1 Replies
1.3k Views
Hello, Our app (OceanDMX Colours) can't communicate with their device over the network, because Local Network access is not applied in the iOS15 Settings. It does not ask about permission when installing and does not show in the Settings App -> Privacy -> Local Network. Was working fine until the release of the iOS 15. We did multiple tests and it works fine with older version of iOS (14.8), when installing it ask for permission and shows up in Settings App -> Privacy -> Local Network with the toggle option. Any ideas how to solve this issue? Has anyone run into the same problem?
Posted
by
Post not yet marked as solved
1 Replies
475 Views
In short, I’m curious if multicast traffic (in general) is forwarded via IOS’s native IKEv2 VPN tunnel? (“road warrior”)… More specifically, I'm trying to understand how that may influence mDNS/Bonjour traffic? NOTE: The way that I am framing this discussion is inherently IPv4/IGMP-centric, although if there's a substantive IPv6 difference, that clarification would also be appreciated. Is there an obvious scenario where mDNS/SSDP/Bonjour name resolution of "something.local” or just “something” (hostname without FQDN) would be resolved on the IP-network associated with the physical ethernet interface / broadcast IP subnet of the end user Apple IOS device (either wifi or LTE), rather than the virtual interface of the VPN? For instance, if the IOS/BSD kernel processing expressly treats multicast differently from unicast traffic, then it’s conceivable that an IKEv2 tunnel could be established, and yet multicast could be operated in a “split-tunnel” mode where (intentionally, or even due to a race condition) mDNS/bonjour traffic emanates locally, or possibly across all interfaces, regardless of preferred-default route? I was hoping you would respond to this query with an answer like: The IKEv2 (road Warrior) VPN ensures all traffic, including broadcast + multicast are exclusively routed to the remote VPN endpoint, with no leakage... or There are known scenarios where multicast or broadcast traffic can operate effectively as a split-tunnel to the unicast traffic routing over the IKEv2 VPN, and if mDNS name resolution is of concern to you, you should review ________ for how to use MDM services to control that. Thank you!
Posted
by
Post not yet marked as solved
1 Replies
477 Views
I made a simple personal-use/testing watchOS app with a button that toggles the "mic muted" state of a chat application for Mac while on the same network. I'm now thinking about adapting this into a proper, distributable app with a companion Mac app. This has me wondering: Is there some solution in Apple's various frameworks that would allow me to "broadcast" a request of this sort from my watch, either over the cloud or over the local network, to my companion Mac app without much in the way of user configuration? My current solution of "make an HTTP request to the hardcoded URI of a server running on my Mac" obviously isn't adaptable to different users or devices. I considered Bonjour but it seems to be partially/fully deprecated and probably wouldn't let the user ensure only their own devices are controlled. Perhaps Handoff or something on CloudKit could be used for this purpose?
Posted
by
Post marked as solved
1 Replies
335 Views
I’m working on cross platform IoT project that requires data between devices on the same WiFi network. Initially, SwiftNIO looked ideal but there appears to be no obvious way to broadcast and listen for a Bonjour service using SwiftNIO. Have I missed any obvious solution or can anyone give any pointers as to a good approach to take? The platforms I’m using are Linux, iOS, and MacOS. Apple's Network framework isn't supported on Linux so I ruled this out. Ideally, an approach using Swift but happy to consider other approaches.
Posted
by
Post marked as solved
6 Replies
726 Views
Hello, I'd like to know whether Multipeer Connectivity (MPC) between two modern iOS devices can support cross-streaming of video content at low latency and relatively high resolution. I learned from Ghostbusters that crossing the streams is a bad idea, but I need this for my app so I'm going to ignore their sage advice. The application I have in mind involves one iOS device (A) live-streaming a feed to another iOS device  (B) running the same app. At the same time, B is live streaming its own feed to A. Both feeds don't need to be crystal clear, but there has to be low latency. The sample code for "Streaming an AR Experience" seems to contain some answers, as it's based on MPC (and ARKit), but my project isn't quite AR and the latency seems high. If MPC isn't suitable for this task (as my searches seem to indicate), is it possible to have one device set up a hotspot and link the two this way to achieve my cross-streaming ambitions? This seems like a more conservative method, assuming the hotspot and its client behave like they're wifi peers (not sure). I might start a new thread with just this question if that's more appropriate. A third idea that's not likely to work (for various reasons) is data transfer over a lightning-lightning or lightning-usb-c connection. If I've missed any other possible solutions to my cross-streaming conundrum, please let me know. I've been reading around this subject on this forum as well and would be hugely grateful if Eskimo would grace me with his wisdom.
Posted
by
wmk
Post not yet marked as solved
0 Replies
222 Views
Hello, We are using Bonjour service for browsing/announcing some services. Everything works fine except the windows event are flooded with Error - "DNSServiceResolve active for over two minutes. This place a considerable burden on the network". Please help here!!
Posted
by
Post not yet marked as solved
1 Replies
520 Views
I have an app, developed in Xamarin Forms, which connects programmatically to a WIFI (with no internet access) exposed by an IoT device. This is the code I use to connect to the wifi network: NEHotspotConfiguration configuration = new NEHotspotConfiguration("ssid"); Device.BeginInvokeOnMainThread(() => { NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(configuration, (NSError error) => { if (error != null) { if (error.LocalizedDescription == "already associated.") { // connected! CommunicateConnected(); } else { // not connected CommunicateNotConnected(); } } else { // connected! CommunicateNotConnected(); } }); }); Once the connection is successfully established the app performs some HTTP calls to the IP of the IoT device. Sometimes it happens that the HTTP calls go over the cellular data connection instead of WIFI connection (because the joined network has no internet connection?) and they fail. (Simply, I see that the 4G icon is still visible instead of the one representing the WIFI connection). The switch between mobile connection and WIFI connection, in these cases, happens after some minutes. Is there a way to force the HTTP calls to go over the just joined network?
Posted
by
Post not yet marked as solved
2 Replies
352 Views
Hi! I have to say I'm not experienced with network programming. Meanwhile, I'm happy my macOs app is doing mostly what it should with Network framework. What I noticed though is that, observing with DNS-SD, all other Bonjour Services on my system show the domain name "Felixs-iMac.local" whereas my app has something like c0d52654-4459-4373-a42d-778805c5107a.local with the string before .local changing on each run. I also noticed that the third party app that I connect my app to locally is not "remembering" my app after restarting. I can set manually "Remote Address" in that app to localhost or 127.0.0.1 and it reconnects next time. I wonder if this is related. How can I have my listener show up with a persitent host/domain name (not sure with terminology here..) so other apps can re-connect? Here's my code for the listener: // advertise Bonjour let udpOption = NWProtocolUDP.Options() let params = NWParameters(dtls: nil, udp: udpOption) if bonjour { params.includePeerToPeer = true } // create the listener listener = try! NWListener(using: params, on: 9001) // Bonjour service if bonjour { listener?.service = NWListener.Service(name: "ControlPilot", type: "_osc._udp", domain: nil, txtRecord: nil) }
Posted
by
Post marked as solved
2 Replies
434 Views
Hi! I have an app with Multipeer Connectivity setup and working properly. I now would like to add an app clip that is also able to connect to the main app target via Multipeer Connectivity. I've added the NSLocalNetworkUsageDescription as well as the NSBonjourServices to the app clip's info.plist, just like I did for the main app target, however when I run the app clip target, I get the following output at the Xcode console: [MCNearbyServiceBrowser] NSNetServiceBrowser did not search with error dict [{     NSNetServicesErrorCode = "-72008";     NSNetServicesErrorDomain = 10; }]. I'm now wondering if it is possible to have app clips leverage Multipeer Connectivity and, if so, what else I should do to resolve the issue. Thanks in advance!
Posted
by
Post not yet marked as solved
0 Replies
217 Views
Hello, I have a question about below site. https://developer.apple.com/licensing-trademarks/bonjour/ In the Bonjour for Windows Bundling Agreement item Link to "Bonjour SDK for Windows" in No.1 is also linked to "Bonjour for Windows installer" in No.3 lists only "Bonjour SDK for Windows" in both. Are "Bonjour for Windows" and "Bonjour SDK for Windows" the same thing? Will I bundle "Bonjour SDK for Windows" instead of bundling "Bonjour for Windows installer" into a Windows application?
Posted
by
Post marked as solved
2 Replies
347 Views
Hi team. Like the title, I'm figure out how to create my app so that I don't explicitly display local network privacy alerts. https://developer.apple.com/forums/thread/664116 This thread was a little helpful, but I couldn't find a clear way. Is there a way to automatically reject without explicitly displaying an alert, even if permission is required, such as plist settings? Thanks.
Posted
by
Post not yet marked as solved
2 Replies
241 Views
I know that the Multipeer Connectivity framework uses bonjour to discover local devices. Another app in our app suite uses a bonjour implementation for zeroconf. Can I use the Multipeer framework in a new application to discover the same services as the other apps in the suite without needing to modify the implementation in the other applications?
Posted
by