How to implement UDP client and send data in Swift on iPhone?

后端 未结 4 1740
遇见更好的自我
遇见更好的自我 2020-12-15 13:21

I want to develop UDP client and send data in Swift.

I have reference the following link:

Swift: Receive UDP with GCDAsyncUdpSocket

Retrieving a stri

4条回答
  •  一生所求
    2020-12-15 13:49

    for me, I used this, and its usage:

    broadcastConnection = UDPBroadcastConnection(port: 35602) { [unowned self] (response: (ipAddress: String, port: Int, response: [UInt8])) -> Void in
        print("Received from \(response.ipAddress):\(response.port):\n\n\(response.response)")
    }
    

提交回复
热议问题