Re: NWConnection vs. NSURLSessionStreamTask
Re: NWConnection vs. NSURLSessionStreamTask
- Subject: Re: NWConnection vs. NSURLSessionStreamTask
- From: Jens Alfke <email@hidden>
- Date: Mon, 06 Aug 2018 09:41:10 -0700
> On Aug 5, 2018, at 11:15 AM, Daryle Walker <email@hidden> wrote:
>
> But, for client use, are there any pro/cons to using NWConnection versus
> NSURLSessionStreamTask for non-HTTP-based protocols (including the many
> pre-HTTP ones)?
The obvious: Network.framework is only available from iOS 12 / macOS 10.14.
We used NSURLSessionStreamTask in Couchbase Lite 2.0, and it's unfortunately
somewhat buggy. On iOS 10 it would crash periodically. On iOS 11 it's fine for
the most part unless the device is behind an HTTP proxy, and then it will
sometimes write data in the wrong order[1] and occasionally crash[2]. This
caused a panic situation for us, because a major customer has all of their
devices behind a proxy, so we unfortunately had to rip out the
NSURLSessionStreamTask code and replace it with NSStream.
Of course YMMV, and we couldn't identify exactly what triggered these bugs,
other than that they all looked like the result of thread-safety problems
inside the implementation of NSURLSessionStreamTask.
—Jens
[1]: rdar://41140274
[2]: rdar://41162231
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden