Receive udp broadcast packets ios

2019-02-14 13:03发布

I'm almost completely done with and iOS client for my REST service. The only thing I'm missing is the ability for the client to listen on the network for a UDP broadcast that receives the host display name and base URL for uploads. There could be multiple servers on the network broadcasting and waiting for uploads.

Asynchronous is preferred. The servers will be displayed to the user as the device discovers them and I want the user to be able to select a server at any point in time.

The broadcaster is sending to 255.255.255.255 and does not expect any data back.

I am a beginner in objective c so something simple and easy to use is best.

1条回答
▲ chillily
2楼-- · 2019-02-14 13:46

I recommend looking at CocoaAsyncSocket. It can handle UDP sockets well. I haven't tried listening to a broadcast with it, but it's probably your best bet.

查看更多
登录 后发表回答