BSD Sockets do not work in iPhone 3G environment

I noticed that many times when developing for iPhone 3G, BSD socket functions simply fail. I also noticed that at that time the 3G antenna was not even turned on, and there was no WIFI Access for backing up the network call (so it seems ridiculous that it did not enable network request support). This information was verified using an Apple application in the SDK called Connectivity Test, or something like that.

Basically, if you download Safari or something like that, then quickly download the application, it will be fine. Of course, this is not perfect. Apparently, for an apple, gethostbyname () or something like that 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 include the Antenna, but calling all the functions of Objective-C CFNetwork does. I need portable code, so is there a way to keep the existing BSD setup? I really don't like coding in Objective-C, so if someone knows this will work, it will be awesome.

+3
source share
1 answer

CFStream Socket Additions is what Apple recommends using BSD instead of direct sockets. They specifically warn about using BSD sockets here :

BSD (POSIX) iPhone OS, . , iPhone OS, VPN On Demand, . API, CFStream .

, CFNetwork .. Objective-C, C .

+8

Source: https://habr.com/ru/post/1737944/


All Articles