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

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

问题描述

我几乎已经完成了我的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.

我是目标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.

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

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