SSDP Failing On iOS 14 devices

In our application we are configuring a network device to accept local wifi connectivity credentials from the app. Once the device connected to local wifi, we are using SSDP to find the device and communicate.

Above connection process worked seamlessly till iOS13 and started producing connectivity issues over iOS14 beta devices. We are getting an 'Address already in use (48)' error, when we try to bind the UDP socket for a device connection.

We have tried following to resolve the issue
  • Made sure user accept network connection as per local network privacy added in iOS 14

  • Requested and obtained new com.apple.developer.networking.multicast entitlement for accepting and receiving broadcasts

  • Upgraded to latest beta softwares (iOS 14 beta 7)

However we are still ending up with 'Address already use error'. After reading forum over SSDP and multicast entitlement issues, we found following thread related to our experience.

https://developer.apple.com/forums/thread/655920?answerId=625327022#625327022

Technical Details
We are trying to bind a UDP socket with reuse port configuration. App tries to bind '0.0.0.0' with port address '55555' in which other device sending the local broadcasts.

At this moment, we are blocked with this defect and any insightful directions will be greatly appreciated. Is this a bug in iOS beta software?




Answered by mraj35 in 641648022
Issue is resolved in iOS 14 b3. Looking forward to the public release with this fix.
I have a test project that does pretty much this and I didn’t encounter any problems. By a happy coincidence I posted the key snippet to another thread this morning.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thank you "Eskimo" for your response. We are trying to receive broadcast messages from network device on port '55555'.

We have changed port to '55556' and app can bind to the port successfully. So in iOS14 apple might be using port '55555' for something and we can't use it any more. I have verified it in a sample project and we can't use port '55555' anymore.
I’m posting a link to the new thread that you created for this. If I learn anything about this, I’ll follow up there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Same problem, here is our code, same problem with GCDAsyncUdpSocket library.
If i use an other port it works.

Code Block swift
class ViewController: UIViewController {
    var group: NWConnectionGroup!
    override func viewDidLoad() {
        super.viewDidLoad()
        guard let multicast = try? NWMulticastGroup(for: [ .hostPort(host: "224.0.0.251", port: 55555) ])
        else { fatalError("") }
        group = NWConnectionGroup(with: multicast, using: .udp)
        group.setReceiveHandler(maximumMessageSize: 16384, rejectOversizedMessages: true) { (message, content, isComplete) in
            print("MESSAGE: \(String(describing: message.remoteEndpoint))")
        }
        group.stateUpdateHandler = { (newState) in
            print("STATUS: \(String(describing: newState))")
        }
        group.start(queue: .main)
    }
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        send()
    }
    func send(){
        let groupSendContent = Data("helloAll".utf8)
        group.send(content: groupSendContent) { error in
            if let err = error{
                print("Send complete with error \(err)")
            }
        }
    }
}


Accepted Answer
Issue is resolved in iOS 14 b3. Looking forward to the public release with this fix.

Issue is resolved in iOS 14 b3.

Cool. That gels with my understanding. Thanks for closing the loop here.

There’s also one clarification. This fix frees up port 55555 for UDP. The port is still used by the system for TCP. Fixing that would be more challenging. It seems that most folks only care about the UDP side. If you care about the TCP side, you should file a new bug with an explanation as to why your app needs to use port 55555 on tCP.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
SSDP Failing On iOS 14 devices
 
 
Q