In the chapter " Using Sockets and Streams" in the " Network Programming Topics Concept Guide ", Apple says:
Note. . The POSIX network does not activate the cellular radio station in iOS. For this reason, the POSIX network interface is generally discouraged by iOS.
Also in the chapter " Network Tips and Errors" in the " Networking Overview ", Apple says:
On iOS, using sockets directly using the POSIX or CFSocket functions does not automatically activate cellular modem devices or on demand VPNs.
Well, thatβs why you can't use POSIX sockets or CFSocket on iOS, which is just a thin POSIX socket shell supporting an asynchronous network via RunLoops. No problems. But which API should you use if you need a UDP socket ?
Apple goes on to say in the β Networking Tips and Handicaps β chapter in β Networking Overview β:
Avoid resolving DNS names before connecting to the host
Ideally, there should be an API for managing UDP sockets other than the POSIX API and CFSocket, which accepts DNS names instead of IP addresses for the destination address.
I may be blind, but I can not find such an API. Any ideas?
Using any third-party API (not Apple) is not interesting, since such an API should be based either on the Apple API, in which case I can use this Apple API directly. Writing your own cover API around POSIX sockets is a piece of cake, I wrote so many socket wrappers before, I already know all the unpleasant pitfalls. However, I will not use the POSIX API, which is the original problem here.
ios udp networking
Mecki
source share