BSD UDP 套接字是否可以与 iOS 的 VoIP 后台模式一起使用?
我无法让它工作,但这并不意味着它不可能。
我看到其他人说我需要使用 TCP 端口
,但是有人有任何指向任何类型的官方文档的指示吗?
I can't get it to work, but that doesn't mean it is not possible.
I've seen other people say that I need to use a TCP Port
, but does anyone have any pointers to any kind of official documentation that would have the final say?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
是的,这就是重点。
但在 iOS 4.2.1(例如)中,您可以在后台以 UDP 方式接收数据,而无需任何确认。
只需将 CFReadStream 声明为在 applicationDidEnterBackground 中监听的 VoIP 套接字...从 iOS 4.3 及更高版本开始,该方法不再起作用。
此外,Media5 使用“技巧”来保持应用程序处于活动状态,从而在后台也通过 UDP 接收来电。
Yes, that's the point.
But in iOS 4.2.1 (for example) you can receive in UDP while in background WITHOUT any ack.
Just declaring a CFReadStream as a VoIP socket listening in applicationDidEnterBackground... From iOS 4.3 and above that method doesn't work anymore.
Also Media5 uses a "trick" to keep active the app, thus receiving incoming calls in background also with UDP.
Apple 可能不会提供如此明确的文档,听起来像“后台的 UDP 是不可能的”。
但事实是,官方文档指出使用这些接口之一来执行后台网络:
- NSInputStream 和 NSOutputStream
- NSURL请求
- CFReadStreamRef 和 CFWriteStreamRef
这就是说,我相信流概念不能包装非连接的 UDP 模式套接字。
http://lists.apple.com/archives/cocoa-dev /2010/Jul/msg00091.html
因此,您可以将其理解为 Apple 只允许在后台模式下打开数据“流”,而不是 UDP 套接字。
我实际上不知道 Counterpath 的 Bria 是如何设法执行他们的 UDP 后台的,但假设他们有某种 hack 在后台执行代码,而不是将一个特殊的套接字标记为“保持活动状态”
There wil be possibly no such clear documentations from Apple sounding like "UDP on background is not possible".
But the fact is that the official documentation states to use one of these interface to perform background networking :
- NSInputStream and NSOutputStream
- NSURLRequest
- CFReadStreamRef and CFWriteStreamRef
This said, i believe the stream concept can't wrap a non connected UDP mode socket.
http://lists.apple.com/archives/cocoa-dev/2010/Jul/msg00091.html
So you could understand it like Apple only allowing "streams" of data to be open in background mode and not UDP sockets.
I actually don't know how Counterpath's Bria managed to perform their UDP backgrounding, but the hypothesis is that they have some kind of hack to execute code in background instead of marking a special socket as "to be maintained living"
根据我的测试,UDP 后台在 iOS >= 4.3 上不太可能。
From my tests, UDP backgrounding is not more possible with iOS >= 4.3.
这个技巧是否包括在切换到背景时播放无声声音?因为我觉得已经没用了...
Does this trick consist of playing a silent sound when switching to background ? Because i think it didn't work anymore...
对于当前版本的 iOS,仅允许在后台模式下使用具有 VOIP 属性的 TCP 套接字。
读取流=NULL;
写流=NULL;
这将创建与服务器的简单 tcp 连接,套接字类型为 VOIP。然后您必须在属性列表中添加应用程序后台模式。
For current version iOS only allow TCP socket with VOIP property in background mode.
readStream=NULL;
writeStream=NULL;
This will create simple tcp connection with server and socket type is VOIP. Then you must add application background mode in property list.