Hi,
Objective:
iOS 14, iPhone needs to connect to device on local network without knowing its hostname; only port is known.
Do I understand it correctly that the only way to do it is to request com.apple.developer.networking.multicast entitlement and execute:
Then from
Thanks
Code source
Objective:
iOS 14, iPhone needs to connect to device on local network without knowing its hostname; only port is known.
Do I understand it correctly that the only way to do it is to request com.apple.developer.networking.multicast entitlement and execute:
Code Block guard let multicast = try? NWMulticastGroup(for: [ .hostPort(host: "224.0.0.251", port: 5353) ]) else { fatalError(...) } let group = NWConnectionGroup(from: multicast, using: .udp) group.setReceiveHandler(maximumMessageSize: 16384, rejectOversizedMessages: true) { (message, content, isComplete) in print("Received message from \(String(describing: message.remoteEndpoint))") }
Then from
Code Block message.remoteEndpoint
I can infer hostname (with matching port, of course) to which I need initiate Code Block NWConnection
?Thanks
Code source
Communicating over a NWMulticastGroup is one way to connect to a device on a local network without knowing the hostname. Some use SSDP for this type of communication. If you know the service that is being used on the network or the local name of the machine you need to connect to, you can also use Bonjour.Do I understand it correctly that the only way to do it is to request com.apple.developer.networking.multicast entitlement and execute:
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com