Send UDP Protocol is not working in Xcode 16 iOS18

func setupUDPSocket() {
        stopSearch()
        
        udpSocket = GCDAsyncUdpSocket(delegate: self, delegateQueue: DispatchQueue.main)
        do {
            try udpSocket?.bind(toPort: 4012)
            try udpSocket?.beginReceiving()
            try udpSocket?.joinMulticastGroup("239.255.255.250")
        } catch let error {
            DispatchQueue.main.async {
                
                print(Thread.current)
                print(error)
                print(error)
            }
        }
    }
private func search() {
        guard let udpSocket = udpSocket else {
            print("not set udpSocket")
            stopSearch()
            return
        }
        
        let message = "M-SEARCH * HTTP/1.1\r\n" +
        "HOST: 239.255.255.250:1900\r\n" +
        "MAN: \"ssdp:discover\"\r\n" +
        "MX: 3\r\n" +
        "ST: ssdp:all\r\n" +
        "\r\n"

        let data = message.data(using: .utf8)!
        udpSocket.send(data, toHost: "239.255.255.250", port: 1900, withTimeout: -1, tag: 0)
    }

This is my send SSDP code, my project was inited in Objective-C, recently I update xcode to 16, I get Error Domain=NSPOSIXErrorDomain Code=65 "No route to host", when I send UPD data in iOS 18, but iOS 17 is ok. Even I found, if I init a new project in Swift, this bug is disappear.

Answered by DTS Engineer in 812077022

Ah, SSDP, it’s the gift that keeps on giving )-:

I have specific advice on this topic. Go to Extra-ordinary Networking, click the link for Don’t Try to Get the Device’s IP Address, and then read the Service Discovery section.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Ah, SSDP, it’s the gift that keeps on giving )-:

I have specific advice on this topic. Go to Extra-ordinary Networking, click the link for Don’t Try to Get the Device’s IP Address, and then read the Service Discovery section.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Send UDP Protocol is not working in Xcode 16 iOS18
 
 
Q