ios接收udp广播包 [英] Receive udp broadcast packets ios

查看:33
本文介绍了ios接收udp广播包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 REST 服务几乎已经完成了 iOS 客户端.我唯一缺少的是客户端能够在网络上侦听接收主机显示名称和用于上传的基本 URL 的 UDP 广播.网络上可能有多个服务器正在广播并等待上传.

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.

广播公司正在向 255.255.255.255 发送数据,预计不会返回任何数据.

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

我是 Objective c 的初学者,所以最好是简单易用的.

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

推荐答案

我推荐看看 CocoaAsyncSocket.它可以很好地处理 UDP 套接字.我没试过用它收听广播,但这可能是你最好的选择.

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.

这篇关于ios接收udp广播包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆