iphone - How to set VoIP mode on a socket in iOS 4 -


i'm trying set socket in voip mode on iphone, app can woken when event happens. have simple server write socket if , if app should wake , talk main web service something. calling cfreadstreamsetproperty() on stream attached socket seems return zero, if i'm not mistaken false, meaning stream did not recognize and/or accept property value. read in previous question facility not available on simulator, tried on real phone, same result.

how can figure out why call failing?

the code below:

- (id) init {     nslog(@"notificationclient init, host = %@", [self getnotificationhostname]);     cfhostref notificationhost = cfhostcreatewithname(kcfallocatordefault, (cfstringref)[self getnotificationhostname]);     cfstreamcreatepairwithsockettocfhost(kcfallocatordefault, notificationhost, [self getnotificationport], &_fromserver, &_toserver);     bool status;     status = cfreadstreamopen(_fromserver);     status = cfreadstreamsetproperty(_fromserver, kcfstreamnetworkservicetype, kcfstreamnetworkservicetypevoip);     nslog(@"status setting voip mode on socket %d", status);     status = cfwritestreamopen(_toserver);     [self sendmessage:@"strt" withargument:@"iphone"];     [self startreceivingmessages];     return self; } 

hmm... looks there 2 problems. first, need set property before opening stream. , second, looks works if on main thread when this.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -