iPhone UDP broadcast and response

前端 未结 2 1527
自闭症患者
自闭症患者 2021-02-04 15:12

I need to send out a UDP broadcast from an iPhone, and then listen for a UDP response with a timeout period. I have found Apple\'s UDPEcho example but I am not sure if it\'s wh

2条回答
  •  长发绾君心
    2021-02-04 16:12

    You can use cocoaAsyncSocket which is easier to use than apple native classes.
    It support UDP with AsyncUdpSocket class.

    AsyncUdpSocket is a UDP/IP socket networking library that wraps CFSocket. It works almost exactly like the TCP version, but is designed specifically for UDP. This includes queued non-blocking send/receive operations, full delegate support, run-loop based, self-contained class, and support for IPv4 and IPv6

提交回复
热议问题