BSD Sockets don't behave in a iPhone 3G environment

Posted by Kyle on Stack Overflow See other posts from Stack Overflow or by Kyle
Published on 2010-03-21T20:42:09Z Indexed on 2010/03/21 20:51 UTC
Read the original article Hit count: 554

I noticed that many times while developing for an iPhone 3G, BSD socket functions will simply fail. I also noticed at the time, the 3G antenna wasn't even ON, nor was there WIFI Access to back up the network call (So it seems ridiculous that it doesn't turn on to support the network request).. This information was verified with an app from Apple in the SDK called Connectivity Test, or something of the sort.

Basically if you load Safari or something, then quickly load up the App it would be fine.. Of course that's not ideal. Apparently, to apple, gethostbyname() or something of the sort is by no means a reason to turn on the Antenna.

I contacted Apple about this, and they said that the BSD functions do not switch the Antenna on, but calling all of the Objective-C CFNetwork functions do. I want portable code, so is there a way to keep my existing BSD setup? I really dislike coding in Objective-C, so if anyone knows a work around, that would be awesome.

© Stack Overflow or respective owner

Related posts about apple

Related posts about iphone