Receive udp broadcast packets ios(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广播包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ios接收udp广播包
基础教程推荐
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01