Post not yet marked as solved
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?
Post not yet marked as solved
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!
Post not yet marked as solved
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?
Post not yet marked as solved
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
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!
Post not yet marked as solved
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
Post not yet marked as solved
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 ?
Post not yet marked as solved
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()
}
}
}
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.
Post not yet marked as solved
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
Post not yet marked as solved
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?
Post not yet marked as solved
I would like to build mDNSResponder for Windows 10 so that we can distribute it with our Windows software. It's my understanding that the source code should be available here:
https://opensource.apple.com/tarballs/mDNSResponder/
I've download the majority of the tarballs and found that none of the recent releases include the mDNSWindows" directory, which is referenced by the included Visual Studio solution. I've emailed opensource @ apple.com
multiple times asking how I can obtain the missing sources but haven't received a response.
Does anyone know why the Windows sources are missing from the tarballs or how to obtain them?
Thanks,
Michael
Post not yet marked as solved
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'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?
Post not yet marked as solved
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 🙇♂️
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
Post not yet marked as solved
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.
Post not yet marked as solved
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
Post not yet marked as solved
Is there any mechanism to disable this user prompt during development? This completely breaks automated testing setups.
Post not yet marked as solved
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?
Post not yet marked as solved
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?