I've found pretty interesting bug in YouTube app - it blocks SSDP multicast for other apps on tvOS.
Problem: If you run YouTube and then any other app that listens for SSDP packets if will fail with "Address already in use" error. Looks like Google devs forgot to add SO_REUSEPORT / SO_REUSEADDR to multicast listener.
Question: Can Apple force Google to fix tvOS YouTube app as it affects other apps?
Note: I already submitted bug report to Google, but I can't track it and probably I won't get any response.
Here is the code how I check it:
guard let multicastGroup = try? NWMulticastGroup(for: [ .hostPort(host: "239.255.255.250", port: 1900) ]) else {
print("Failed to create multicast group")
return
}
let connectionGroup = NWConnectionGroup(with: multicastGroup, using: .udp)
connectionGroup.setReceiveHandler() { [weak self] message, content, isComplete in
print("Received message from \(String(describing: message.remoteEndpoint))")
if let content = content, let message = String(data: content, encoding: .utf8) {
print("Message: \(message)")
}
}
connectionGroup.stateUpdateHandler = { newState in
print("Group entered state \(String(describing: newState))")
}
connectionGroup.start(queue: .main)
Result:
Group entered state failed(POSIXErrorCode: Address already in use)