You have misunderstood what this stream type does. It does not enable your app to run a TCP connection for an arbitrarily long amount of time in the background. Rather, it’s all about quality of service (QoS), both within the kernel and on the ‘wire’.
Looking at the documentation for this API, it’s easy to see how you were lead astray. I’ve filed a bug (r. 48105066) about that.
In the meantime, the absolute best place to find information about these QoS values is the comments for the various
<sys/socket.h>. And if you’re interested in more background info, watch WWDC 2016 Session 714 Networking for the Modern Internet.
Coming back to your actual goal, if you want to download a large resource while your app is in the background then
NSURLSessionis your only good choice. You wrote:
By the way, in order to support SNI, I use the
CFReadStreaminstead of the
What do you mean by this? I assume you’re referring to Server Name Indication, and that’s definitely supported by
NSURLSession. Is that support insufficient? If so, please elaborate.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"