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

178 Posts

Post

Replies

Boosts

Views

Activity

Bonjour discovery with NetServiceBrowser not working in iOS and iPadOS 14
My app has to find a certain bonjour service on the local network and my code works fine for iOS 12/13 as well as macOS Big Sur and Catalina. The exact same code fails on iOS and iPadOS 14 with this error: ["NSNetServicesErrorDomain": 10, "NSNetServicesErrorCode": -72000] Which I have looked into and -72000 is an "Unknown error". I am using NetServiceBrowser to find the service and here is my code: class Bonjour: NSObject {     var discovered: [DiscoveredInstance] = []     let bonjourBrowser = NetServiceBrowser()     var discoveredService: NetService?     override init() {         super.init()         bonjourBrowser.delegate = self         startDiscovery()     }     func startDiscovery() {         self.bonjourBrowser.searchForServices(ofType: "_some-service._tcp.", inDomain: "local")     } } extension Bonjour: NetServiceBrowserDelegate, NetServiceDelegate {     func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) {         discoveredService = service         discoveredService?.delegate = self         discoveredService?.resolve(withTimeout: 3)     }     func netServiceBrowser(_ browser: NetServiceBrowser, didNotSearch errorDict: [String : NSNumber]) {         print(errorDict)     }     func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) {         self.discovered.removeAll { $0.name == service.name }     }     func netServiceDidResolveAddress(_ sender: NetService) {         if let data = sender.txtRecordData() {             let dict = NetService.dictionary(fromTXTRecord: data)             /// do stuff with txtRecord dict here and then add to discovered array.             discoveredService = nil         }     } } I have no idea what could be causing the error and have tried enabling networking permissions and capabilities but have not been able to stop the error from occurring. Thanks.
8
1
12k
Nov ’21
iOS 15 Local Network permission issue
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?
1
0
3.4k
Nov ’21
Bonjour stopped responding in iOS15
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!
3
0
1.2k
Oct ’21
Receiving UDP/5353 packets in iOS app
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 ?
2
0
1.8k
Oct ’21
NEDNSProxyProvider: network troubles on iOS 14
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()     }   } }
3
0
1.1k
Sep ’21
NSNetService is deprecated, how to advertise network service that is written using non-Apple API?
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.
2
0
1.4k
Sep ’21
Combining NSBonjourServices with NSLocation
We are working on a project that communicates location data via a network. We are able to get the Location Services to work using: <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>Location data will be used to monitor your position</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Location data will be used to monitor your position</string> And we able to get the networking functionality to work using: <key>NSBonjourServices</key> <array> <string>_appName-data._tcp</string> <string>_appName-data._udp</string> <string>_appName-chat._tcp</string> <string>_appName-chat._tcp</string> </array> and <key>NSLocalNetworkUsageDescription</key> <string>appName needs to use your phone&apos;s data to discover devices nearby</string> However, we are only able to use these independently. When both are included together, the NSBonjourServices quits working, but the location services works. Any one know what needs to be done to have both working together?
6
0
941
Aug ’21
Establishing stable multi peer data transfer with Network framework
Hi all, I'm relatively new to posting in forums, but here we go. I am currently working on an enterprise platform for iPad, and we've decided to implement Network framework to link the iPads of a particular location together for data transfer. Basically the iPads will be constantly kept in sync with one another by changing each iPad's Core Data memory store accordingly. This works great when all iPads are within range! However, when an iPad leaves the area and returns, it does not catch the updates of the others or send out its own updates efficiently. It sometimes gets them, sometimes does not. There is a lot of nuance to networking code that I'm not familiar with yet, and I frequently get very low-level network errors that I do not understand very well, and which yield little to no search results when looked up. There aren't a lot of examples out there, and I'm not sure I've set up the network to do peer to peer properly, which is reflected in the errors I wanted to ask about. There are two in specific, one is far less reproducible. The first yields a crash log, so if anyone can point me to a tool to debug this one that would be great. It also does not crash the app or cause permanent functionality loss, but that's not a good reason to ignore a bug, as that could be very different in production. I'd like to know how to handle this correctly. I have some basic print debug statements on the fail states of NWBrowser, NWConnection, and NWListener, and none of them are ever hit when these particular errors surface. __nwlog_err_simulate_crash simulate crash already simulated nw_channel_disconnect_flow protocol ip_listener has invalid disconnected callback, dumping backtrace:     [arm64] libnetcore-2288.140.7   0  libnetwork.dylib          0x00000001a14e9d2c __nw_create_backtrace_string + 120   1  libnetwork.dylib          0x00000001a1177b28 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3210024   2  libnetwork.dylib          0x00000001a11865a0 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3270048   3  libnetwork.dylib          0x00000001a1184964 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3262820   4  libnetwork.dylib          0x00000001a118335c 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3257180   5  libnetwork.dylib          0x00000001a1182da4 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3255716   6  libnetwork.dylib          0x00000001a146f124 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 6320420   7  libnetwork.dylib          0x00000001a13d9f0c 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 5709580   8  libnetwork.dylib          0x00000001a13d9b34 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 5708596   9  libnetwork.dylib          0x00000001a13d92bc 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 5706428   10 libnetwork.dylib          0x00000001a1180888 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3246216   11 libnetwork.dylib          0x00000001a117e2b0 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3236528   12 libnetwork.dylib          0x00000001a117d91c 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3234076   13 libdispatch.dylib          0x0000000102555de0 _dispatch_client_callout + 20   14 libdispatch.dylib          0x0000000102558ed0 _dispatch_continuation_pop + 616   15 libdispatch.dylib          0x000000010256eca0 _dispatch_source_invoke + 1384   16 libdispatch.dylib          0x0000000102560324 _dispatch_workloop_invoke + 2200   17 libdispatch.dylib          0x000000010256ba50 _dispatch_workloop_worker_thread + 1600   18 libsystem_pthread.dylib       0x00000001eb4c27a4 _pthread_wqthread + 276   19 libsystem_pthread.dylib       0x00000001eb4c974c start_wqthread + 8 The other error is about a TCP listener failing to receive data within a time limit, and the connection in that instance will permanently die. Meaning, the iPad will never communicate with the others again after that. I haven't seen that one since I made some changes, but I'd rather be sure it is addressed. However it again has to do with connections, which leads me to suspect I haven't got them set up quite right. Has anyone encountered these issues before, or done something similar and can provide a bit of direction? I would love some insights 🙇‍♂️
3
0
1.2k
Aug ’21
NWBrowser + VPN + iOS
I am currently working on an iOS application that would ideally allow end users to create a VPN connection, find the server with Bonjour (NWBrowser) and then connect to it and then view media files using a media browser I built that runs locally on the server. I've already built a Mac OS X application that can perform the functionality in question, but iOS is a bit different. Is this possible?
5
0
868
Aug ’21
Multipeer Connectivity - Preventing unwanted connections
Hi, I'm trying to use the Multipeer Connectivity framework in my latest app to create a mesh network between many devices (20+). I only plan to have each device connected to at most 4 other devices to avoid the limitations of the MC framework. However, when testing it out I found that when connecting multiple peers together, the MCSessions seemed to sync up. I.e. when I had device 1 connect to device 2, and then device 1 connect to device 3, automatically device 2 would connect to device 3. Is there any way to prevent these automatic connections from forming between devices? I am using swift 5 / iOS 14 Thanks
2
0
874
Aug ’21
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.
3
0
1.7k
Aug ’21
Unable to connect multiple devices over peer to peer by using Bonjour
Hi, I am implementing an iPhone/iPad and mac app that allows users to send each other messages using the bonjour protocol. Basically, a server publishes his service over bonjour and the clients connected to the same wifi can discover his service and connect to it to start sending messages, it works fine with client and service communication but if I want to achieve peer to peer communication between multiple devices then I don't know how can I get list of connected Devices in network and how multiple devices can communicate with each other like peer to peer connectivity without using server/host? So how can be this possible?
9
0
2.7k
Aug ’21
Bonjour discovery with NetServiceBrowser not working in iOS and iPadOS 14
My app has to find a certain bonjour service on the local network and my code works fine for iOS 12/13 as well as macOS Big Sur and Catalina. The exact same code fails on iOS and iPadOS 14 with this error: ["NSNetServicesErrorDomain": 10, "NSNetServicesErrorCode": -72000] Which I have looked into and -72000 is an "Unknown error". I am using NetServiceBrowser to find the service and here is my code: class Bonjour: NSObject {     var discovered: [DiscoveredInstance] = []     let bonjourBrowser = NetServiceBrowser()     var discoveredService: NetService?     override init() {         super.init()         bonjourBrowser.delegate = self         startDiscovery()     }     func startDiscovery() {         self.bonjourBrowser.searchForServices(ofType: "_some-service._tcp.", inDomain: "local")     } } extension Bonjour: NetServiceBrowserDelegate, NetServiceDelegate {     func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) {         discoveredService = service         discoveredService?.delegate = self         discoveredService?.resolve(withTimeout: 3)     }     func netServiceBrowser(_ browser: NetServiceBrowser, didNotSearch errorDict: [String : NSNumber]) {         print(errorDict)     }     func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) {         self.discovered.removeAll { $0.name == service.name }     }     func netServiceDidResolveAddress(_ sender: NetService) {         if let data = sender.txtRecordData() {             let dict = NetService.dictionary(fromTXTRecord: data)             /// do stuff with txtRecord dict here and then add to discovered array.             discoveredService = nil         }     } } I have no idea what could be causing the error and have tried enabling networking permissions and capabilities but have not been able to stop the error from occurring. Thanks.
Replies
8
Boosts
1
Views
12k
Activity
Nov ’21
iOS 15 Local Network permission issue
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?
Replies
1
Boosts
0
Views
3.4k
Activity
Nov ’21
Bonjour stopped responding in iOS15
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!
Replies
3
Boosts
0
Views
1.2k
Activity
Oct ’21
mirror.dca.local - which Bonjour service ?
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
Replies
0
Boosts
0
Views
454
Activity
Oct ’21
Network framework send file using TCP protocol
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
Replies
4
Boosts
0
Views
1.4k
Activity
Oct ’21
Receiving UDP/5353 packets in iOS app
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 ?
Replies
2
Boosts
0
Views
1.8k
Activity
Oct ’21
NEDNSProxyProvider: network troubles on iOS 14
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()     }   } }
Replies
3
Boosts
0
Views
1.1k
Activity
Sep ’21
NetWorkListener and NetworkConncetion listening and receiving error.
What is "NetworkConstants.serviceName" "NetworkConstants.serviceType" in NetworkListener Class will you please suggest me. And func didReceivedData(connection: NetworkConnection, with messageResponse: ConnectionMessage) what should be in "ConnectionMessage" and each of in "NetworkConnection" Class. Reagards, Narendra Sorathiya
Replies
8
Boosts
0
Views
1.3k
Activity
Sep ’21
NSNetService is deprecated, how to advertise network service that is written using non-Apple API?
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.
Replies
2
Boosts
0
Views
1.4k
Activity
Sep ’21
Will apple accept my app if the app is connecting to a local network device and communicate with them
Im trying to develop an app, which will do a TCP connection with the local network device and perform some trigger event with the local network device. Basically to get some input from the app and display it on the local network device. Is there any standard I have to follow if Im doing this?
Replies
1
Boosts
0
Views
639
Activity
Sep ’21
Combining NSBonjourServices with NSLocation
We are working on a project that communicates location data via a network. We are able to get the Location Services to work using: <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>Location data will be used to monitor your position</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Location data will be used to monitor your position</string> And we able to get the networking functionality to work using: <key>NSBonjourServices</key> <array> <string>_appName-data._tcp</string> <string>_appName-data._udp</string> <string>_appName-chat._tcp</string> <string>_appName-chat._tcp</string> </array> and <key>NSLocalNetworkUsageDescription</key> <string>appName needs to use your phone&apos;s data to discover devices nearby</string> However, we are only able to use these independently. When both are included together, the NSBonjourServices quits working, but the location services works. Any one know what needs to be done to have both working together?
Replies
6
Boosts
0
Views
941
Activity
Aug ’21
Establishing stable multi peer data transfer with Network framework
Hi all, I'm relatively new to posting in forums, but here we go. I am currently working on an enterprise platform for iPad, and we've decided to implement Network framework to link the iPads of a particular location together for data transfer. Basically the iPads will be constantly kept in sync with one another by changing each iPad's Core Data memory store accordingly. This works great when all iPads are within range! However, when an iPad leaves the area and returns, it does not catch the updates of the others or send out its own updates efficiently. It sometimes gets them, sometimes does not. There is a lot of nuance to networking code that I'm not familiar with yet, and I frequently get very low-level network errors that I do not understand very well, and which yield little to no search results when looked up. There aren't a lot of examples out there, and I'm not sure I've set up the network to do peer to peer properly, which is reflected in the errors I wanted to ask about. There are two in specific, one is far less reproducible. The first yields a crash log, so if anyone can point me to a tool to debug this one that would be great. It also does not crash the app or cause permanent functionality loss, but that's not a good reason to ignore a bug, as that could be very different in production. I'd like to know how to handle this correctly. I have some basic print debug statements on the fail states of NWBrowser, NWConnection, and NWListener, and none of them are ever hit when these particular errors surface. __nwlog_err_simulate_crash simulate crash already simulated nw_channel_disconnect_flow protocol ip_listener has invalid disconnected callback, dumping backtrace:     [arm64] libnetcore-2288.140.7   0  libnetwork.dylib          0x00000001a14e9d2c __nw_create_backtrace_string + 120   1  libnetwork.dylib          0x00000001a1177b28 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3210024   2  libnetwork.dylib          0x00000001a11865a0 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3270048   3  libnetwork.dylib          0x00000001a1184964 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3262820   4  libnetwork.dylib          0x00000001a118335c 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3257180   5  libnetwork.dylib          0x00000001a1182da4 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3255716   6  libnetwork.dylib          0x00000001a146f124 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 6320420   7  libnetwork.dylib          0x00000001a13d9f0c 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 5709580   8  libnetwork.dylib          0x00000001a13d9b34 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 5708596   9  libnetwork.dylib          0x00000001a13d92bc 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 5706428   10 libnetwork.dylib          0x00000001a1180888 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3246216   11 libnetwork.dylib          0x00000001a117e2b0 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3236528   12 libnetwork.dylib          0x00000001a117d91c 40081C9D-213A-3EFC-8E66-3FC0E3110449 + 3234076   13 libdispatch.dylib          0x0000000102555de0 _dispatch_client_callout + 20   14 libdispatch.dylib          0x0000000102558ed0 _dispatch_continuation_pop + 616   15 libdispatch.dylib          0x000000010256eca0 _dispatch_source_invoke + 1384   16 libdispatch.dylib          0x0000000102560324 _dispatch_workloop_invoke + 2200   17 libdispatch.dylib          0x000000010256ba50 _dispatch_workloop_worker_thread + 1600   18 libsystem_pthread.dylib       0x00000001eb4c27a4 _pthread_wqthread + 276   19 libsystem_pthread.dylib       0x00000001eb4c974c start_wqthread + 8 The other error is about a TCP listener failing to receive data within a time limit, and the connection in that instance will permanently die. Meaning, the iPad will never communicate with the others again after that. I haven't seen that one since I made some changes, but I'd rather be sure it is addressed. However it again has to do with connections, which leads me to suspect I haven't got them set up quite right. Has anyone encountered these issues before, or done something similar and can provide a bit of direction? I would love some insights 🙇‍♂️
Replies
3
Boosts
0
Views
1.2k
Activity
Aug ’21
NWBrowser + VPN + iOS
I am currently working on an iOS application that would ideally allow end users to create a VPN connection, find the server with Bonjour (NWBrowser) and then connect to it and then view media files using a media browser I built that runs locally on the server. I've already built a Mac OS X application that can perform the functionality in question, but iOS is a bit different. Is this possible?
Replies
5
Boosts
0
Views
868
Activity
Aug ’21
CFNetwork crash in iOS 14
I am getting dozens of crash reports for our app running on iOS 14. The crash log (please see attached) indicates the crash on Thread 0. I am not able to reproduce the crash. CrashLog
Replies
7
Boosts
0
Views
2.0k
Activity
Aug ’21
Multipeer Connectivity - Preventing unwanted connections
Hi, I'm trying to use the Multipeer Connectivity framework in my latest app to create a mesh network between many devices (20+). I only plan to have each device connected to at most 4 other devices to avoid the limitations of the MC framework. However, when testing it out I found that when connecting multiple peers together, the MCSessions seemed to sync up. I.e. when I had device 1 connect to device 2, and then device 1 connect to device 3, automatically device 2 would connect to device 3. Is there any way to prevent these automatic connections from forming between devices? I am using swift 5 / iOS 14 Thanks
Replies
2
Boosts
0
Views
874
Activity
Aug ’21
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.
Replies
3
Boosts
0
Views
1.7k
Activity
Aug ’21
Unable to connect multiple devices over peer to peer by using Bonjour
Hi, I am implementing an iPhone/iPad and mac app that allows users to send each other messages using the bonjour protocol. Basically, a server publishes his service over bonjour and the clients connected to the same wifi can discover his service and connect to it to start sending messages, it works fine with client and service communication but if I want to achieve peer to peer communication between multiple devices then I don't know how can I get list of connected Devices in network and how multiple devices can communicate with each other like peer to peer connectivity without using server/host? So how can be this possible?
Replies
9
Boosts
0
Views
2.7k
Activity
Aug ’21
Local Network Privacy - prompt disable?
Is there any mechanism to disable this user prompt during development? This completely breaks automated testing setups.
Replies
1
Boosts
0
Views
1.8k
Activity
Aug ’21