Will the BSD UDP Socket work with background VoIP for iOS?

I cannot make it work, but that does not mean that it is impossible.

I saw other people say that I need to use TCP Port, but does anyone have any pointers to any official documentation that has the last word?

+3
source share
5 answers

Yes, that point.

But in iOS 4.2.1 (for example) you can receive UDP in the background without any attacks. Just declaring CFReadStream as a VoIP socket listening in applicationDidEnterBackground ... From iOS 4.3 and above, this method no longer works.

Media5 "", , UDP.

+5

, , Apple, "UDP ".

, , : - NSInputStream NSOutputStream - NSURLRequest - CFReadStreamRef CFWriteStreamRef

, UDP-. http://lists.apple.com/archives/cocoa-dev/2010/Jul/msg00091.html

, , Apple, "" , UDP.

, Counterpath Bria UDP- , , - , " "

+1

UDP iOS >= 4.3.

+1

, ? , ...

0

iOS TCP- VOIP .

ReadStream = NULL;  WriteStream = NULL;

    CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)serverIP, Port, &readStream, &writeStream);

    CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); //VOIP property for input stream
    CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);

    inputStream = (__bridge NSInputStream *)readStream;
    outputStream = (__bridge NSOutputStream *)writeStream;
    [inputStream setDelegate:self];
    [outputStream setDelegate:self];

    [inputStream setProperty:NSStreamNetworkServiceTypeVoIP forKey:NSStreamNetworkServiceType] ;
    [outputStream  setProperty:NSStreamNetworkServiceTypeVoIP forKey:NSStreamNetworkServiceType] ;

    [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    [inputStream open];
    [outputStream open];

tcp , - VOIP. .

0

All Articles