Asynchronously writes the specified data to the stream, and calls a handler upon completion.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The data to be written.
A timeout for writing bytes. If the write is not completed within the specified interval, the write is canceled and the
completionis called with an error. Pass
0to prevent a write from timing out.
The completion handler to call when all bytes are written, or an error occurs. This handler is executed on the delegate queue.
This completion handler takes the following parameter:
An error object that indicates why the write failed, or
nilif the write was successful.
There is no guarantee that the remote side of the stream has received all of the written bytes at the time that
completion is called, only that all of the data has been written to the kernel.