简体   繁体   English

接收udp广播包ios

[英]Receive udp broadcast packets ios

I'm almost completely done with and iOS client for my REST service. 我几乎已经完成了我的REST服务的iOS客户端。 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. 我唯一缺少的是客户端在网络上侦听接收主机显示名称和上传基本URL的UDP广播的能力。 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. 该广播公司正在发送至255.255.255.255并且不期望任何数据。

I am a beginner in objective c so something simple and easy to use is best. 我是目标c的初学者,所以简单易用的东西最好。

I recommend looking at CocoaAsyncSocket . 我建议看看CocoaAsyncSocket It can handle UDP sockets well. 它可以很好地处理UDP套接字。 I haven't tried listening to a broadcast with it, but it's probably your best bet. 我没有尝试用它来收听广播,但这可能是你最好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM