NSURLSessionStreamTask is a concrete subclass of
URLSessionTask. Many of the methods in the
NSURLSessionStreamTask class are documented in
NSURLSessionStreamTask class provides an interface a TCP/IP connection created via
URLSession. Tasks may be created from an
NSURLSession using the
streamTask(with:) methods. They may also created as a result of an
URLSessionDataTask being upgraded via the HTTP
Upgrade: response header and appropriate use of the
httpShouldUsePipelining option of
NSURLSessionStreamTask object perform asynchronous reads and writes, which are enqueued and executed serially, calling a handler upon completion being on the session delegate queue. If the task is canceled, all enqueued reads and writes will call their completion handlers with an appropriate error.
When working with APIs that accept
Stream objects, you can create
OutputStream objects from an
NSURLSessionStreamTask object by calling the
Closing Read and Write Sockets
Completes any enqueued reads and writes, and then closes the read side of the underlying socket.
Completes any enqueued reads and writes, and then closes the write side of the underlying socket.
Starting and Stopping Secure Connections