iOS 4 VOIP应用程序在后台响应 [英] iOS 4 VOIP app responding in the background

查看:221
本文介绍了iOS 4 VOIP应用程序在后台响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iPhone VOIP应用程序,它处理使用BSD套接字设置的多重发送和接收(即电话会议)。我想它能够响应传入的请求,当它在后台,但从我可以理解的iOS 4文档,我只能做一个NSStream对象(或CFRead / WriteStream)通过将属性设置为NSStreamNetworkServiceTypeVoIP 。这是一个问题,因为我的系统是一个基于UDP BSD套接字的应用程序。一切都在一个UDP套接字上接收和发送。

I have an iPhone VOIP app that copes with multi-multi transmit and receive (ie teleconferencing) set up using BSD sockets. I would like it to be able to respond to incoming requests when it is in the background but from what I can understand of the iOS 4 docs I can only do this on an NSStream object (or CFRead/WriteStream) by setting the property to NSStreamNetworkServiceTypeVoIP. This is a bit of a problem as my system is a UDP BSD sockets based application. Everything is received and sent on a single UDP socket.

我需要重写我的音频发送/接收核心来处理NSStreams,可以得到iOS 4以类似的方式处理我的BSD套接字NSStream?我认为这可能是一个问题,因为NSStream是基于事件的。

Am I going to need to re-write my audio transmit/receive core to handle NSStreams or is there a way I can get iOS 4 to handle my BSD socket in a similar way to an NSStream? I assume this may be a problem as an NSStream is event based.

它可以检测应用程序进入后台并构建一个临时NSStream对象通过相关处理传递数据,然后继续正常?是否可以创建UDP NSStream?

Would it be possible to detect when the application goes into the background and build a temporary NSStream object that will pass the data on to through the relevant handling and then continue as normal? Is it even possible to create a UDP NSStream?

任何想法?

推荐答案

您可以使用CFSocketCreateWithNative()从文件描述符创建套接字,然后使用CFStreamCreatePairWithSocket()创建一对流。它可能允许您在UDP套接字上使用它们。只要流不读取数据,除非你问,你可能可以直接使用FD。

You can create a socket from a file descriptor with CFSocketCreateWithNative(), and then create a pair of streams with CFStreamCreatePairWithSocket(). It might let you use them on a UDP socket. Provided the streams don't read data unless you ask, you might be able to get away with using the FD directly.

祝你好运!

这篇关于iOS 4 VOIP应用程序在后台响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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