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

NWBrowser does not discover Meross (Matter device)
Hello, I think that I found a bug with NWBrowser and I'd like to ask you can fix this. Problem NWBrowser does not return the result to the app, while NetServiceBrowser returns. Problem occurs when using only Meross device, in other Matter device cases, both api works fine. Actually I want to get TXT Record from Meross, but failed with NWBrowser Steps Add Meross plug device (Matter, Wi-Fi device) to Apple Home app Turn On Pairing Mode of Meross device When I try to discover it with NWBrowser > it is NOT discovered (with NetServiceBrowser > it is discovered) Results When I use NWBrowser, I can't get any result from the handler. On the other hand, with NetServiceBrowser, I can get a result. When I capture the packets with WireShark, the packets are same on both cases Case1: with NWBrowser Case2: with NetServiceBrowser With same packets, Case1 does not return any result and Case2 returns results. I'm trying to attaching the WireShark capture file and iOS console logs, but it continuosly fails. Please let me know how I can send them. Code Her is my code. NWBrowser let bonjourWithTXT = NWBrowser.Descriptor.bonjourWithTXTRecord(type: "_matterc._udp.", domain: "local.") let params = NWParameters.init() self.nwBrowser = NWBrowser(for: bonjourWithTXT, using: params) self.nwBrowser?.browseResultsChangedHandler = { [weak self] results, changes in // Can not get any results here // } self.nwBrowser?.start(queue: .main) NetServiceBrowser self.bonjourBrowser = NetServiceBrowser() self.bonjourBrowser?.delegate = self self.bonjourBrowser?.searchForServices(ofType: "_matterc._udp.", inDomain: "local.") func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { service.delegate = self service.resolve(withTimeout: resolutionTimeout) netService.insert(service) } func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) { netServices.remove(service) } func netServiceDidResolveAddress(_ service: NetService) { // I can get found services here // }
1
0
1.3k
Apr ’23
Bonjour discovery with NetServiceBrowser not working in iOS
i am using NetServiceBrowser for descovering bonjour services but my app is calling only netBrowserServiceWillSearch delegate method and keep on searching the Bonjour service without ever finding or stoping. class BonjourDiscovery : NetServiceBrowserDelegate, NetServiceDelegate { let serviceBrowser = NetServiceBrowser() @objc func ListOfPrinter(){ serviceBrowser.delegate = self serviceBrowser.searchForServices(ofType: "_printer._tcp", inDomain: "") } func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { print("---------didFind: \(service.name)") } func netServiceBrowserDidStopSearch(_ browser: NetServiceBrowser) { print(#function) } func netServiceBrowser(_ browser: NetServiceBrowser, didNotSearch errorDict: [String : NSNumber]) { print(#function) } func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) { print(#function) } func netServiceBrowserWillSearch(_ browser: NetServiceBrowser) { print(#function) } } info.plist -: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSLocalNetworkUsageDescription</key> <string>Looking for local tcp Bonjour service</string> <key>NSBonjourServices</key> <array> <string>_printer._tcp</string> </array> </dict> </plist> i have tried diffrent things whatever i found on apple forum or stackOverFlow like adding local in inDomain ,replacing _printer._tcp with _printer._tcp. ,but nothing works so far
1
1
1.2k
Mar ’23
Get Model Identifier of Device in Network
I have a couple of Apple devices in my network (both computers and mobile devices). I was wondering if it is possible, to get the model identifier like Macmini9,1 if I have the IP address and/or the Mac address. I am using the NetServiceBrowser and NetService classes to find the devices. If the device has the AirPlay service, I can get the model identifier. However, not all of my devices seem to implement/publish this service. Is there a more general approach? macOS seems to know this information. In the Finder a specific icon is shown, so I guess the model identifier must be published somehow.
4
0
1.8k
Mar ’23
nw_endpoint_type_bonjour_service offers no port or TXT record?
It seems endpoints of type nw_endpoint_type_bonjour_service offer no port number or TXT record. Or at least I am not smart enough to find the functions which provides these things. 😀 The functions with names most suggestive of providing these things don't work, which isn't surprising since they are documented (in the header) to work only for endpoints of other types. This seems like a massive oversight, so I am doubting my sanity. Surely nearly everybody who wants to use nw_endpoint_type_bonjour_service wants a port number and many will want a TXT record. I have resorted to calling DNSServiceResolve to fill the gap. It works but seems… drastic. It makes me wonder why I don't bypass nw_browser_create in favor of DNSServiceBrowse in the first place. What am I missing?
7
0
1.1k
Mar ’23
TCP + UDP connections via Bonjour
For a local video streaming app I want to establish both a TCP and a UDP NWConnection. What is the best way to do this using Bonjour? Do I advertise separate Bonjour services for TCP and UDP? Or if I just advertise one (say TCP), what is the best way of creating a new UDP NWConnection to the same device once the TCP connection has been established?
5
0
1.9k
Mar ’23
'connect' to device from iPad/iPhone/mac via USB-C ethernet adapter in link-local mode fails
We have an issue with creating an ordinary TCP socket connection to a device that is connected on a link-local net (simple peer to peer Ethernet). Our code is in C++ and we use the normal POSIX socket API. The scenario is like this: We have a device with ordinary Ethernet connected to a USB-Ethernet adaptor. We plug in the USB-Ethernet adaptor in a Mac or iPad. The device establishes link-local IP address and announces a service via mDNS/DNS-SD The Mac/iPad Bonjour system picks up the device service and we get the information in our app. Our app want to connect to the service using a normal TCP socket connection to the device's link-local address. So far this is normal and working as expected. However from here something unexpected happens: We create a "socket()" and do a "connect()".  WireShark shows that the TCP connection is established on the correct interface, with the correct destination IP/port, but with a source IP/port from a different interface. Fx. the TCP SYN from the Mac has destination ip 169.254.5.253 (correct) but source IP 192.168.1.101 (wrong - that IP does not exist on that interface). Consequently the TCP connection never get established. Workaround: We have found out that using "bind()" to bind the socket to a specific source link-local IP on the relevant interface works. Then the TCP SYN comes out with correct source IP. However binding an outgoing TCP that is a very unusual thing to and we are surprised that it doesn't just work without it. Other information: Parts of this issue seems to be timing related. Without the "bind()" it sometimes works if we retry the connect after timeout. Occasionally it works the first time. Having a Ethernet switch in between also sometimes helps. Have we missed something or is this a problem in macOS/iOS? Thanks! :)
4
0
1.5k
Feb ’23
Allowing dns wss peer-to-peer connections on IOS app
Hello, I'm trying to allow dns wss peer-to-peer connections on my Iphone app in debug mode. An example for an address it would try to connect to: /dns/example.io/tcp/443/wss/p2p/PeerID I included NSAppTransportSecurity and NSAllowsArbitraryLoads in my info-debug.plist. I also added NSBonjourServices and set the value to an array with the string _dartobservatory._tcp. My .plist file looks like this now: &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt; &lt;string&gt;$(DEVELOPMENT_LANGUAGE)&lt;/string&gt; &lt;key&gt;CFBundleDisplayName&lt;/key&gt; &lt;string&gt;Trappist Extra&lt;/string&gt; &lt;key&gt;CFBundleExecutable&lt;/key&gt; &lt;string&gt;$(EXECUTABLE_NAME)&lt;/string&gt; &lt;key&gt;CFBundleIdentifier&lt;/key&gt; &lt;string&gt;$(PRODUCT_BUNDLE_IDENTIFIER)&lt;/string&gt; &lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt; &lt;string&gt;6.0&lt;/string&gt; &lt;key&gt;CFBundleName&lt;/key&gt; &lt;string&gt;trappist_extra&lt;/string&gt; &lt;key&gt;CFBundlePackageType&lt;/key&gt; &lt;string&gt;APPL&lt;/string&gt; &lt;key&gt;CFBundleShortVersionString&lt;/key&gt; &lt;string&gt;$(FLUTTER_BUILD_NAME)&lt;/string&gt; &lt;key&gt;CFBundleSignature&lt;/key&gt; &lt;string&gt;????&lt;/string&gt; &lt;key&gt;CFBundleVersion&lt;/key&gt; &lt;string&gt;$(FLUTTER_BUILD_NUMBER)&lt;/string&gt; &lt;key&gt;LSRequiresIPhoneOS&lt;/key&gt; &lt;true/&gt; &lt;key&gt;UILaunchStoryboardName&lt;/key&gt; &lt;string&gt;LaunchScreen&lt;/string&gt; &lt;key&gt;UIMainStoryboardFile&lt;/key&gt; &lt;string&gt;Main&lt;/string&gt; &lt;key&gt;NSLocalNetworkUsageDescription&lt;/key&gt; &lt;string&gt;Test Smoldot&lt;/string&gt; &lt;key&gt;UIApplicationSupportsIndirectInputEvents&lt;/key&gt; &lt;true/&gt; &lt;key&gt;NSAppTransportSecurity&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt; &lt;true/&gt; &lt;key&gt;NSAllowsLocalNetworking&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;key&gt;UISupportedInterfaceOrientations&lt;/key&gt; &lt;array&gt; &lt;string&gt;UIInterfaceOrientationPortrait&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeLeft&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeRight&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UISupportedInterfaceOrientations~ipad&lt;/key&gt; &lt;array&gt; &lt;string&gt;UIInterfaceOrientationPortrait&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationPortraitUpsideDown&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeLeft&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeRight&lt;/string&gt; &lt;/array&gt; &lt;key&gt;NSBonjourServices&lt;/key&gt; &lt;array&gt; &lt;string&gt;_dartobservatory._tcp&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UIViewControllerBasedStatusBarAppearance&lt;/key&gt; &lt;false/&gt; &lt;key&gt;CADisableMinimumFrameDurationOnPhone&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;/plist&gt; Unfortunately it still doesn't work. Am I missing something? Thanks in advance!
3
0
1.6k
Feb ’23
Unicast in iOS devices
Hello All, We have a Python and also a NodeJS codes that send mDNS responses in a network. These mDNS responses are sent to specific IP addresses (NOT to the MDNS IP address - 224.0.0.251). For eg. if the IP address of my phone is 192.168.10.125, the server will send a mDNS response to this IP address on port 5353. The response contains the information about a specific device such as a T.V. If my phone is Android, then the packet is recognized and I can see the TV when I open YouTube app and click on Chromecast icon. But the problem is with iOS devices (iPhone and iPad), since I can't see the TV when try to Chromecast from YouTube. On the other hand, if the server sends the packet to MDNS IP address (which is 224.0.0.251), then everything is working fine and I can see the TV while I try to Chromecast in YouTube in both Android and iPhone. So, clearly, Multicast is working in iOS while Unicast is not. Can someone please explain what is the issue here with Unicast in iOS devices and how to handle the same? Looking forward for some help here. Thanking you in advance.
0
0
1.2k
Feb ’23
NWBrowser not working for services named _ssh._tcp
I'm using NWBrowser to connect to devices on my local network. One of the local devices broadcasts a service named "_mik._tcp." the other is "_ssh._tcp." I have no issues connecting to "_mik._tcp." but "_ssh._tcp." never connects. Is there some reason why iOS would be preventing "_ssh._tcp." connections? I have both services listed in the info.plist and have implemented the following NWParameters: let parameters = NWParameters() parameters.allowLocalEndpointReuse = true parameters.acceptLocalOnly = true parameters.allowFastOpen = true parameters.multipathServiceType = .aggregate browser = NWBrowser(for: .bonjour(type: "_ssh._tcp.", domain: "local."), using: parameters) However, with "_ssh._tcp." I never get past the "preparing" state: self.netConnect?.stateUpdateHandler = { (newState) in ... "_mik._tcp." receives both "preparing" and "ready" states almost instantly. Using the Discovery app on my Mac I can see the services listed, however _ssh.tcp has the description SSH Remote Login Protocol which I think is the root of the issue.
8
0
2.2k
Feb ’23
SSDP Discovery Not Working after Update to IOS 16.0
Before Updating to iOS 16.0, SSDP Device Discovery was working perfectly but after the update, it's not working on real devices. Although it's working in Simulator. Below was SSDP Package we are using: https://github.com/pierrickrouxel/SSDPClient After the update to 16.0, its gives below error: [2022-09-17T15:26:27.275+05:30] [INFO] [SSDPDiscovery.swift:113 discoverService(forDuration:searchTarget:port:)] Start SSDP discovery for 10 duration... Started [2022-09-17T15:26:27.279+05:30] [ERROR] [SSDPDiscovery.swift:132 discoverService(forDuration:searchTarget:port:)] Socket error: Error code: -9980(0x-26FC), No route to host Error code: -9980(0x-26FC), No route to host [2022-09-17T15:26:27.279+05:30] [ERROR] [SSDPDiscovery.swift:75 readResponses()] Socket error: Error code: -9982(0x-26FE), Bad file descriptor Error code: -9982(0x-26FE), Bad file descriptor Can someone please help? Our Whole Production is down after the update.
4
3
3.4k
Dec ’22
A problem about remote debug with vpn net environment
Hi, eskimo. When I am searching a way to do the remote iPhone debug with vpn net, I found your answer in https://developer.apple.com/forums/thread/666090. And you said that 'Set up a Bonjour bridge between home and work. This would involve registering the device’s service on the work network and having it point to an IP address that routes to the device on your home network.' May I ask that whether the Bonjour bridge means create a gateway in bonjour service for when I google the words 'set up a bonjour bridge', I can only find the information about enstablishing a gateway in bonjou service.
1
0
1.1k
Nov ’22
Remote installing and launching TVOS app from iOS app
We have both an iOS app and a tvOS app. We'd love to achieve the following scenario: iOS app should be able to detect Apple TV devices in the local network. When the user selects the apple TV device, check if the our tvOS app on apple TV is installed or not on the selected apple tv, If the app is not installed then iOS app can open the app store to launch the install page for the tvOS app on apple tv. The user can download/installation the app of the tvOS app. If the tvOS app is installed then launch the tvOS App on the apple TV. Are there any APIs available to achieve this scenario?
5
0
3.5k
Aug ’22
AirPlay BLE discovery over different NAT was failed
I have Apple TV 4K connected router A, IP is 192.168.1.10. Apple TV send Bluetooth Low Energy(BLE) advertisement with the IP. I captured by BLE sniffer. I try "Screen Mirroring" from MacBook on router B, IP is 192.168.2.10 MacBook send "GET /info...RTSP/1.0" to appleTV:7000. Apple TV replay with 1368 bytes of "RTSP/1.0 200 OK..." that includes device name, type, features. But MacBook does not show my AppleTV as Display list. I like to know why my AppleTV is not recognized as mirroring display even all RTSP traffic has no error. mDNS from AppleTV is blocked by router. Ping from MacBook to Apple TV was success. If Apple TV and MacBook connect on same router, screen mirroring was success. Router A and B : Netgear Nighthawk Router netmask : 255.255.255.0 (both) MacBook : macOS Monterey 12.4 Apple TV : tvOS 15.6(19M65)
0
0
1.8k
Jul ’22
NWBrowser scan Multicast Entitlement requirements
My app is searching for few services which are running on my local network with NetServiceBrowser. As I am searching using _services._dns-sd._udp.local., I have requested and get the permission of com.apple.developer.networking.multicast (which has been discussed here ). I have created a provisioning profile with enabling multicast entitlement according to forum guide. But after that I still have to add Bonjour service types in Info.plist or else NetServiceBrowser throws ["NSNetServicesErrorCode": -72008, "NSNetServicesErrorDomain": 10]. <key>NSBonjourServices</key> <array>     <string>_mydummy._tcp</string>     <string>_services._dns-sd._udp</string> </array> Do I still have to add each service into info.plist although I have added multicast entitlement?
1
0
1.2k
Jun ’22
Windows 10 Bonjour dns-sd service announcement fails after several minutes
I have been using Windows 10 with some PHP that I wrote and Bonjour to share a non-AirScan (non eSCL) scanner by way of the eSCL protocol. This has worked fine consistently across many Windows 10 home, and pro (64 bit only) systems that I have tested on. Recently however my primary Windows 10 development machine died (may it rest in pieces). This was always my only dedicated windows machine for testing so I converted a Linux box to Windows 10 Home x86_64. As I previously had tested on Windows 10 Home I saw no potential for issues. I install Bonjour Print services for Windows, and use the following command... dns-sd -R "Samsung SCX-5935NX@eSCL" _uscan._tcp local 8000 "note=Twain2AirScan Version 2.09" "duplex=T" "is=platen,adf" "cs=color,grayscale,binary" "pdl=application/pdf,image/jpeg" "uuid=3508b420-00a0-004e-00b5-002507510abf" "rs=eSCL" "representation=http://10.0.0.149:8000/scannericons/Samsung-SCX-5935NX.png" "vers=2.2" "usb_MDL=Samsung SCX-5935NX@eSCL" "usb_MFG=Samsung" "mdl=SCX-5935NX" "mfg=Samsung" "ty=Samsung SCX-5935NX@eSCL" "adminurl=http://10.0.0.149:8000/index.php" "txtvers=1" This has worked fine till I built this new machine. Now what I see is that it works for up to several minutes then it stops. On my Mac I run... dns-sd -B _uscan._tcp and see... 16:00:52.405 Add    2  7 local.        _uscan._tcp.     Samsung SCX-5935NX@eSCL That is fine usually for several munures then I see... 16:07:22.300 Rmv    0  7 local.        _uscan._tcp.     Samsung __SCX-5935NX@eSCL I see no reason why it should suddenly fail and have not seen this previously after multiple installs. I have disabled Windows Firewall and put UAC control to minimum . This entire project relies on this one small piece of code that now suddenly is failing on one system. This same system BTW was completely rebuilt twice with fresh software downloads of Bonjour Print services for Windows , and I have tested the Bonjour SDK for Windows as well. Normally I would launch this from a VBS script that launches a BAT file , this is to suppress the window. It does not matter how I run it , I have even tried running it from Task manager and it simply fails after several minutes. Originally I would have though there was a way to make a more permanent. configuration rather than a long winded command but I think this is the only way, correct? Anyone know what else I can try? Thanks Mark
1
0
1.9k
Jun ’22
Building dnsextd(8) for macOS in 2022
Looks like dnsextd(8) was removed from macOS in 10.15 Catalina, and building from source isn't easy. I used the attached patch to build mDNSResponder 1310.140.1, which removes unused functions except for setTrafficClass which is unused by the target (it passes mDNSFalse for useBackgroundTraffic). We're planning to use this as a frontend to BIND 9.18.3 with an external daemon to verify TSIG for dynamic updates. With MDM we should be able to easily provision new TSIG keys remotely on servers, then communicate them out-of-band to the daemon and (hopefully) have the process work almost automatically. I have heard only RC4 is supported in released versions of macOS, and the implementation is broken in macOS Monterey. dnsextd.txt Comments welcome
3
0
1.5k
Jun ’22
NWConnection has only Link Local Address?
Hi, I wanted to try using the new NWBrowser available in iOS 13 to replace my old Bonjour browsing code(NetServiceBrowser), problem is I'm unabe to get all IPv6 Addresses(except link local address) of the service I'm looking for. In my environment, when I checked with ifconfig command, there are three IPv6 addresses. fe80::c092:a0ff:fe51:3c8 fd1c:efcd:7e66:0:c092:a0ff:fe51:3c8 fd1c:efcd:7e66:0:68d:6b27:81e2:7511 Using NWBrowser and NWConnection, I ended up getting #1 address but I couldn't get #2, #3 addresses. Here is my code. let bonjour = NWBrowser.Descriptor.bonjourWithTXTRecord(type: serviceType, domain: searchDomain) let params = NWParameters.init() self.nwBrowser = NWBrowser(for: bonjour, using: params) self.nwBrowser?.browseResultsChangedHandler = { [weak self] results, changes in guard let self = self else { return } for change in changes { if case .added(let result) = change { let connection = NWConnection(to: result.endpoint, using: .udp) connection.stateUpdateHandler = { [weak self] state in switch state { case .ready: if let remoteEndpoint= connection.currentPath?.remoteEndpoint, case .hostPort(let host, let port) = innerEndpoint { // here I can get #1 address from host // but, I couldn't get #2, #3 addresses } } } connection.start(queue: .main) } } } self.nwBrowser?.start(queue: .main) Using NetServiceBrowser and netServiceDidResolveAddress(), I can get All IP addresses(#1, #2, #3) Here is my code. let netServiceBrowser = NetServiceBrowser() netServiceBrowser.delegate = self netServiceBrowser.searchForServices(ofType: serviceType, inDomain: searchDomain) func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { service.delegate = self service.resolve(withTimeout: resolutionTimeoutSeconds) } func netServiceDidResolveAddress(_ service: NetService) { // service.addresses is [Data], I can get all addresses I want. } I wonder if getting only Link Local Address through NWConnection is the intended behavior. Or is there a way to get all address using NWBrowser and NWConnection?
1
1
2.0k
Jun ’22
NWBrowser does not discover Meross (Matter device)
Hello, I think that I found a bug with NWBrowser and I'd like to ask you can fix this. Problem NWBrowser does not return the result to the app, while NetServiceBrowser returns. Problem occurs when using only Meross device, in other Matter device cases, both api works fine. Actually I want to get TXT Record from Meross, but failed with NWBrowser Steps Add Meross plug device (Matter, Wi-Fi device) to Apple Home app Turn On Pairing Mode of Meross device When I try to discover it with NWBrowser > it is NOT discovered (with NetServiceBrowser > it is discovered) Results When I use NWBrowser, I can't get any result from the handler. On the other hand, with NetServiceBrowser, I can get a result. When I capture the packets with WireShark, the packets are same on both cases Case1: with NWBrowser Case2: with NetServiceBrowser With same packets, Case1 does not return any result and Case2 returns results. I'm trying to attaching the WireShark capture file and iOS console logs, but it continuosly fails. Please let me know how I can send them. Code Her is my code. NWBrowser let bonjourWithTXT = NWBrowser.Descriptor.bonjourWithTXTRecord(type: "_matterc._udp.", domain: "local.") let params = NWParameters.init() self.nwBrowser = NWBrowser(for: bonjourWithTXT, using: params) self.nwBrowser?.browseResultsChangedHandler = { [weak self] results, changes in // Can not get any results here // } self.nwBrowser?.start(queue: .main) NetServiceBrowser self.bonjourBrowser = NetServiceBrowser() self.bonjourBrowser?.delegate = self self.bonjourBrowser?.searchForServices(ofType: "_matterc._udp.", inDomain: "local.") func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { service.delegate = self service.resolve(withTimeout: resolutionTimeout) netService.insert(service) } func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) { netServices.remove(service) } func netServiceDidResolveAddress(_ service: NetService) { // I can get found services here // }
Replies
1
Boosts
0
Views
1.3k
Activity
Apr ’23
Bonjour discovery with NetServiceBrowser not working in iOS
i am using NetServiceBrowser for descovering bonjour services but my app is calling only netBrowserServiceWillSearch delegate method and keep on searching the Bonjour service without ever finding or stoping. class BonjourDiscovery : NetServiceBrowserDelegate, NetServiceDelegate { let serviceBrowser = NetServiceBrowser() @objc func ListOfPrinter(){ serviceBrowser.delegate = self serviceBrowser.searchForServices(ofType: "_printer._tcp", inDomain: "") } func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { print("---------didFind: \(service.name)") } func netServiceBrowserDidStopSearch(_ browser: NetServiceBrowser) { print(#function) } func netServiceBrowser(_ browser: NetServiceBrowser, didNotSearch errorDict: [String : NSNumber]) { print(#function) } func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) { print(#function) } func netServiceBrowserWillSearch(_ browser: NetServiceBrowser) { print(#function) } } info.plist -: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSLocalNetworkUsageDescription</key> <string>Looking for local tcp Bonjour service</string> <key>NSBonjourServices</key> <array> <string>_printer._tcp</string> </array> </dict> </plist> i have tried diffrent things whatever i found on apple forum or stackOverFlow like adding local in inDomain ,replacing _printer._tcp with _printer._tcp. ,but nothing works so far
Replies
1
Boosts
1
Views
1.2k
Activity
Mar ’23
Get Model Identifier of Device in Network
I have a couple of Apple devices in my network (both computers and mobile devices). I was wondering if it is possible, to get the model identifier like Macmini9,1 if I have the IP address and/or the Mac address. I am using the NetServiceBrowser and NetService classes to find the devices. If the device has the AirPlay service, I can get the model identifier. However, not all of my devices seem to implement/publish this service. Is there a more general approach? macOS seems to know this information. In the Finder a specific icon is shown, so I guess the model identifier must be published somehow.
Replies
4
Boosts
0
Views
1.8k
Activity
Mar ’23
nw_endpoint_type_bonjour_service offers no port or TXT record?
It seems endpoints of type nw_endpoint_type_bonjour_service offer no port number or TXT record. Or at least I am not smart enough to find the functions which provides these things. 😀 The functions with names most suggestive of providing these things don't work, which isn't surprising since they are documented (in the header) to work only for endpoints of other types. This seems like a massive oversight, so I am doubting my sanity. Surely nearly everybody who wants to use nw_endpoint_type_bonjour_service wants a port number and many will want a TXT record. I have resorted to calling DNSServiceResolve to fill the gap. It works but seems… drastic. It makes me wonder why I don't bypass nw_browser_create in favor of DNSServiceBrowse in the first place. What am I missing?
Replies
7
Boosts
0
Views
1.1k
Activity
Mar ’23
TCP + UDP connections via Bonjour
For a local video streaming app I want to establish both a TCP and a UDP NWConnection. What is the best way to do this using Bonjour? Do I advertise separate Bonjour services for TCP and UDP? Or if I just advertise one (say TCP), what is the best way of creating a new UDP NWConnection to the same device once the TCP connection has been established?
Replies
5
Boosts
0
Views
1.9k
Activity
Mar ’23
'connect' to device from iPad/iPhone/mac via USB-C ethernet adapter in link-local mode fails
We have an issue with creating an ordinary TCP socket connection to a device that is connected on a link-local net (simple peer to peer Ethernet). Our code is in C++ and we use the normal POSIX socket API. The scenario is like this: We have a device with ordinary Ethernet connected to a USB-Ethernet adaptor. We plug in the USB-Ethernet adaptor in a Mac or iPad. The device establishes link-local IP address and announces a service via mDNS/DNS-SD The Mac/iPad Bonjour system picks up the device service and we get the information in our app. Our app want to connect to the service using a normal TCP socket connection to the device's link-local address. So far this is normal and working as expected. However from here something unexpected happens: We create a "socket()" and do a "connect()".  WireShark shows that the TCP connection is established on the correct interface, with the correct destination IP/port, but with a source IP/port from a different interface. Fx. the TCP SYN from the Mac has destination ip 169.254.5.253 (correct) but source IP 192.168.1.101 (wrong - that IP does not exist on that interface). Consequently the TCP connection never get established. Workaround: We have found out that using "bind()" to bind the socket to a specific source link-local IP on the relevant interface works. Then the TCP SYN comes out with correct source IP. However binding an outgoing TCP that is a very unusual thing to and we are surprised that it doesn't just work without it. Other information: Parts of this issue seems to be timing related. Without the "bind()" it sometimes works if we retry the connect after timeout. Occasionally it works the first time. Having a Ethernet switch in between also sometimes helps. Have we missed something or is this a problem in macOS/iOS? Thanks! :)
Replies
4
Boosts
0
Views
1.5k
Activity
Feb ’23
Allowing dns wss peer-to-peer connections on IOS app
Hello, I'm trying to allow dns wss peer-to-peer connections on my Iphone app in debug mode. An example for an address it would try to connect to: /dns/example.io/tcp/443/wss/p2p/PeerID I included NSAppTransportSecurity and NSAllowsArbitraryLoads in my info-debug.plist. I also added NSBonjourServices and set the value to an array with the string _dartobservatory._tcp. My .plist file looks like this now: &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt; &lt;string&gt;$(DEVELOPMENT_LANGUAGE)&lt;/string&gt; &lt;key&gt;CFBundleDisplayName&lt;/key&gt; &lt;string&gt;Trappist Extra&lt;/string&gt; &lt;key&gt;CFBundleExecutable&lt;/key&gt; &lt;string&gt;$(EXECUTABLE_NAME)&lt;/string&gt; &lt;key&gt;CFBundleIdentifier&lt;/key&gt; &lt;string&gt;$(PRODUCT_BUNDLE_IDENTIFIER)&lt;/string&gt; &lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt; &lt;string&gt;6.0&lt;/string&gt; &lt;key&gt;CFBundleName&lt;/key&gt; &lt;string&gt;trappist_extra&lt;/string&gt; &lt;key&gt;CFBundlePackageType&lt;/key&gt; &lt;string&gt;APPL&lt;/string&gt; &lt;key&gt;CFBundleShortVersionString&lt;/key&gt; &lt;string&gt;$(FLUTTER_BUILD_NAME)&lt;/string&gt; &lt;key&gt;CFBundleSignature&lt;/key&gt; &lt;string&gt;????&lt;/string&gt; &lt;key&gt;CFBundleVersion&lt;/key&gt; &lt;string&gt;$(FLUTTER_BUILD_NUMBER)&lt;/string&gt; &lt;key&gt;LSRequiresIPhoneOS&lt;/key&gt; &lt;true/&gt; &lt;key&gt;UILaunchStoryboardName&lt;/key&gt; &lt;string&gt;LaunchScreen&lt;/string&gt; &lt;key&gt;UIMainStoryboardFile&lt;/key&gt; &lt;string&gt;Main&lt;/string&gt; &lt;key&gt;NSLocalNetworkUsageDescription&lt;/key&gt; &lt;string&gt;Test Smoldot&lt;/string&gt; &lt;key&gt;UIApplicationSupportsIndirectInputEvents&lt;/key&gt; &lt;true/&gt; &lt;key&gt;NSAppTransportSecurity&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt; &lt;true/&gt; &lt;key&gt;NSAllowsLocalNetworking&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;key&gt;UISupportedInterfaceOrientations&lt;/key&gt; &lt;array&gt; &lt;string&gt;UIInterfaceOrientationPortrait&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeLeft&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeRight&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UISupportedInterfaceOrientations~ipad&lt;/key&gt; &lt;array&gt; &lt;string&gt;UIInterfaceOrientationPortrait&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationPortraitUpsideDown&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeLeft&lt;/string&gt; &lt;string&gt;UIInterfaceOrientationLandscapeRight&lt;/string&gt; &lt;/array&gt; &lt;key&gt;NSBonjourServices&lt;/key&gt; &lt;array&gt; &lt;string&gt;_dartobservatory._tcp&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UIViewControllerBasedStatusBarAppearance&lt;/key&gt; &lt;false/&gt; &lt;key&gt;CADisableMinimumFrameDurationOnPhone&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;/plist&gt; Unfortunately it still doesn't work. Am I missing something? Thanks in advance!
Replies
3
Boosts
0
Views
1.6k
Activity
Feb ’23
Unicast in iOS devices
Hello All, We have a Python and also a NodeJS codes that send mDNS responses in a network. These mDNS responses are sent to specific IP addresses (NOT to the MDNS IP address - 224.0.0.251). For eg. if the IP address of my phone is 192.168.10.125, the server will send a mDNS response to this IP address on port 5353. The response contains the information about a specific device such as a T.V. If my phone is Android, then the packet is recognized and I can see the TV when I open YouTube app and click on Chromecast icon. But the problem is with iOS devices (iPhone and iPad), since I can't see the TV when try to Chromecast from YouTube. On the other hand, if the server sends the packet to MDNS IP address (which is 224.0.0.251), then everything is working fine and I can see the TV while I try to Chromecast in YouTube in both Android and iPhone. So, clearly, Multicast is working in iOS while Unicast is not. Can someone please explain what is the issue here with Unicast in iOS devices and how to handle the same? Looking forward for some help here. Thanking you in advance.
Replies
0
Boosts
0
Views
1.2k
Activity
Feb ’23
NWBrowser not working for services named _ssh._tcp
I'm using NWBrowser to connect to devices on my local network. One of the local devices broadcasts a service named "_mik._tcp." the other is "_ssh._tcp." I have no issues connecting to "_mik._tcp." but "_ssh._tcp." never connects. Is there some reason why iOS would be preventing "_ssh._tcp." connections? I have both services listed in the info.plist and have implemented the following NWParameters: let parameters = NWParameters() parameters.allowLocalEndpointReuse = true parameters.acceptLocalOnly = true parameters.allowFastOpen = true parameters.multipathServiceType = .aggregate browser = NWBrowser(for: .bonjour(type: "_ssh._tcp.", domain: "local."), using: parameters) However, with "_ssh._tcp." I never get past the "preparing" state: self.netConnect?.stateUpdateHandler = { (newState) in ... "_mik._tcp." receives both "preparing" and "ready" states almost instantly. Using the Discovery app on my Mac I can see the services listed, however _ssh.tcp has the description SSH Remote Login Protocol which I think is the root of the issue.
Replies
8
Boosts
0
Views
2.2k
Activity
Feb ’23
SSDP Discovery Not Working after Update to IOS 16.0
Before Updating to iOS 16.0, SSDP Device Discovery was working perfectly but after the update, it's not working on real devices. Although it's working in Simulator. Below was SSDP Package we are using: https://github.com/pierrickrouxel/SSDPClient After the update to 16.0, its gives below error: [2022-09-17T15:26:27.275+05:30] [INFO] [SSDPDiscovery.swift:113 discoverService(forDuration:searchTarget:port:)] Start SSDP discovery for 10 duration... Started [2022-09-17T15:26:27.279+05:30] [ERROR] [SSDPDiscovery.swift:132 discoverService(forDuration:searchTarget:port:)] Socket error: Error code: -9980(0x-26FC), No route to host Error code: -9980(0x-26FC), No route to host [2022-09-17T15:26:27.279+05:30] [ERROR] [SSDPDiscovery.swift:75 readResponses()] Socket error: Error code: -9982(0x-26FE), Bad file descriptor Error code: -9982(0x-26FE), Bad file descriptor Can someone please help? Our Whole Production is down after the update.
Replies
4
Boosts
3
Views
3.4k
Activity
Dec ’22
Change hostname on NWListener
Hi, for a particular application, I need to change the hostname advertised on the NWListener service. Is it possible? Thanks
Replies
13
Boosts
0
Views
2.2k
Activity
Nov ’22
A problem about remote debug with vpn net environment
Hi, eskimo. When I am searching a way to do the remote iPhone debug with vpn net, I found your answer in https://developer.apple.com/forums/thread/666090. And you said that 'Set up a Bonjour bridge between home and work. This would involve registering the device’s service on the work network and having it point to an IP address that routes to the device on your home network.' May I ask that whether the Bonjour bridge means create a gateway in bonjour service for when I google the words 'set up a bonjour bridge', I can only find the information about enstablishing a gateway in bonjou service.
Replies
1
Boosts
0
Views
1.1k
Activity
Nov ’22
NSNetServiceBrowser is deprecated, but no replacement
I saw NSNetServiceBrowser is marked as deprecated on Apple document. But I cannot see replacement of this class. I need to write mDNS finder program. Should I use NSNetServiceBrowser or another class?
Replies
3
Boosts
0
Views
2.7k
Activity
Nov ’22
How can i implement Bonjour
• Browses for services on local or remote domains using Bonjour • Automatically detects all available local domains and services • Displays information about each service, including domain name, IP address(es), and TXT record
Replies
1
Boosts
0
Views
1k
Activity
Nov ’22
Remote installing and launching TVOS app from iOS app
We have both an iOS app and a tvOS app. We'd love to achieve the following scenario: iOS app should be able to detect Apple TV devices in the local network. When the user selects the apple TV device, check if the our tvOS app on apple TV is installed or not on the selected apple tv, If the app is not installed then iOS app can open the app store to launch the install page for the tvOS app on apple tv. The user can download/installation the app of the tvOS app. If the tvOS app is installed then launch the tvOS App on the apple TV. Are there any APIs available to achieve this scenario?
Replies
5
Boosts
0
Views
3.5k
Activity
Aug ’22
AirPlay BLE discovery over different NAT was failed
I have Apple TV 4K connected router A, IP is 192.168.1.10. Apple TV send Bluetooth Low Energy(BLE) advertisement with the IP. I captured by BLE sniffer. I try "Screen Mirroring" from MacBook on router B, IP is 192.168.2.10 MacBook send "GET /info...RTSP/1.0" to appleTV:7000. Apple TV replay with 1368 bytes of "RTSP/1.0 200 OK..." that includes device name, type, features. But MacBook does not show my AppleTV as Display list. I like to know why my AppleTV is not recognized as mirroring display even all RTSP traffic has no error. mDNS from AppleTV is blocked by router. Ping from MacBook to Apple TV was success. If Apple TV and MacBook connect on same router, screen mirroring was success. Router A and B : Netgear Nighthawk Router netmask : 255.255.255.0 (both) MacBook : macOS Monterey 12.4 Apple TV : tvOS 15.6(19M65)
Replies
0
Boosts
0
Views
1.8k
Activity
Jul ’22
NWBrowser scan Multicast Entitlement requirements
My app is searching for few services which are running on my local network with NetServiceBrowser. As I am searching using _services._dns-sd._udp.local., I have requested and get the permission of com.apple.developer.networking.multicast (which has been discussed here ). I have created a provisioning profile with enabling multicast entitlement according to forum guide. But after that I still have to add Bonjour service types in Info.plist or else NetServiceBrowser throws ["NSNetServicesErrorCode": -72008, "NSNetServicesErrorDomain": 10]. <key>NSBonjourServices</key> <array>     <string>_mydummy._tcp</string>     <string>_services._dns-sd._udp</string> </array> Do I still have to add each service into info.plist although I have added multicast entitlement?
Replies
1
Boosts
0
Views
1.2k
Activity
Jun ’22
Windows 10 Bonjour dns-sd service announcement fails after several minutes
I have been using Windows 10 with some PHP that I wrote and Bonjour to share a non-AirScan (non eSCL) scanner by way of the eSCL protocol. This has worked fine consistently across many Windows 10 home, and pro (64 bit only) systems that I have tested on. Recently however my primary Windows 10 development machine died (may it rest in pieces). This was always my only dedicated windows machine for testing so I converted a Linux box to Windows 10 Home x86_64. As I previously had tested on Windows 10 Home I saw no potential for issues. I install Bonjour Print services for Windows, and use the following command... dns-sd -R "Samsung SCX-5935NX@eSCL" _uscan._tcp local 8000 "note=Twain2AirScan Version 2.09" "duplex=T" "is=platen,adf" "cs=color,grayscale,binary" "pdl=application/pdf,image/jpeg" "uuid=3508b420-00a0-004e-00b5-002507510abf" "rs=eSCL" "representation=http://10.0.0.149:8000/scannericons/Samsung-SCX-5935NX.png" "vers=2.2" "usb_MDL=Samsung SCX-5935NX@eSCL" "usb_MFG=Samsung" "mdl=SCX-5935NX" "mfg=Samsung" "ty=Samsung SCX-5935NX@eSCL" "adminurl=http://10.0.0.149:8000/index.php" "txtvers=1" This has worked fine till I built this new machine. Now what I see is that it works for up to several minutes then it stops. On my Mac I run... dns-sd -B _uscan._tcp and see... 16:00:52.405 Add    2  7 local.        _uscan._tcp.     Samsung SCX-5935NX@eSCL That is fine usually for several munures then I see... 16:07:22.300 Rmv    0  7 local.        _uscan._tcp.     Samsung __SCX-5935NX@eSCL I see no reason why it should suddenly fail and have not seen this previously after multiple installs. I have disabled Windows Firewall and put UAC control to minimum . This entire project relies on this one small piece of code that now suddenly is failing on one system. This same system BTW was completely rebuilt twice with fresh software downloads of Bonjour Print services for Windows , and I have tested the Bonjour SDK for Windows as well. Normally I would launch this from a VBS script that launches a BAT file , this is to suppress the window. It does not matter how I run it , I have even tried running it from Task manager and it simply fails after several minutes. Originally I would have though there was a way to make a more permanent. configuration rather than a long winded command but I think this is the only way, correct? Anyone know what else I can try? Thanks Mark
Replies
1
Boosts
0
Views
1.9k
Activity
Jun ’22
Building dnsextd(8) for macOS in 2022
Looks like dnsextd(8) was removed from macOS in 10.15 Catalina, and building from source isn't easy. I used the attached patch to build mDNSResponder 1310.140.1, which removes unused functions except for setTrafficClass which is unused by the target (it passes mDNSFalse for useBackgroundTraffic). We're planning to use this as a frontend to BIND 9.18.3 with an external daemon to verify TSIG for dynamic updates. With MDM we should be able to easily provision new TSIG keys remotely on servers, then communicate them out-of-band to the daemon and (hopefully) have the process work almost automatically. I have heard only RC4 is supported in released versions of macOS, and the implementation is broken in macOS Monterey. dnsextd.txt Comments welcome
Replies
3
Boosts
0
Views
1.5k
Activity
Jun ’22
NWConnection has only Link Local Address?
Hi, I wanted to try using the new NWBrowser available in iOS 13 to replace my old Bonjour browsing code(NetServiceBrowser), problem is I'm unabe to get all IPv6 Addresses(except link local address) of the service I'm looking for. In my environment, when I checked with ifconfig command, there are three IPv6 addresses. fe80::c092:a0ff:fe51:3c8 fd1c:efcd:7e66:0:c092:a0ff:fe51:3c8 fd1c:efcd:7e66:0:68d:6b27:81e2:7511 Using NWBrowser and NWConnection, I ended up getting #1 address but I couldn't get #2, #3 addresses. Here is my code. let bonjour = NWBrowser.Descriptor.bonjourWithTXTRecord(type: serviceType, domain: searchDomain) let params = NWParameters.init() self.nwBrowser = NWBrowser(for: bonjour, using: params) self.nwBrowser?.browseResultsChangedHandler = { [weak self] results, changes in guard let self = self else { return } for change in changes { if case .added(let result) = change { let connection = NWConnection(to: result.endpoint, using: .udp) connection.stateUpdateHandler = { [weak self] state in switch state { case .ready: if let remoteEndpoint= connection.currentPath?.remoteEndpoint, case .hostPort(let host, let port) = innerEndpoint { // here I can get #1 address from host // but, I couldn't get #2, #3 addresses } } } connection.start(queue: .main) } } } self.nwBrowser?.start(queue: .main) Using NetServiceBrowser and netServiceDidResolveAddress(), I can get All IP addresses(#1, #2, #3) Here is my code. let netServiceBrowser = NetServiceBrowser() netServiceBrowser.delegate = self netServiceBrowser.searchForServices(ofType: serviceType, inDomain: searchDomain) func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { service.delegate = self service.resolve(withTimeout: resolutionTimeoutSeconds) } func netServiceDidResolveAddress(_ service: NetService) { // service.addresses is [Data], I can get all addresses I want. } I wonder if getting only Link Local Address through NWConnection is the intended behavior. Or is there a way to get all address using NWBrowser and NWConnection?
Replies
1
Boosts
1
Views
2.0k
Activity
Jun ’22