Since Apple Multipeer framework does not really work without crashes, I implemented my own multipeer with the Network.framework. like
let tcpOptions = NWProtocolTCP.Options.createDefault()
let parameters = NWParameters(tls: NWProtocolTLS.Options(), tcp: tcpOptions)
parameters.setDefaultSettings()
let browser = NWBrowser(
for: .bonjour(
type: config.bonjourServiceType,
domain: nil
),
using: parameters
)
and
extension NWParameters {
func setDefaultSettings() {
self.includePeerToPeer = true
self.requiredInterfaceType = .wifi
self.preferNoProxies = true
}
}
extension NWProtocolTCP.Options {
static func createDefault() -> NWProtocolTCP.Options {
let tcpOptions = NWProtocolTCP.Options()
tcpOptions.enableKeepalive = true
tcpOptions.keepaliveIdle = 10 // 10 seconds keepalive interval
tcpOptions.noDelay = true // Disable Nagle's algorithm for low latency
return tcpOptions
}
}
it works well up to approx. 30 meter outside with free view. What's the max range for the peer to peer via bonjour? And is there a way to get longer distance than 30 meter?
That seems pretty respectable.
It’s not specified but, as a general rule, it’s quite short. Extending the range is tricky because the longer the range the harder it is for the various peers to ‘converge’ on a configuration.
No.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"