Write data on a stream asynchronously.
When the closure is invoked with an indication of success, the data is only written to the
stream, but not necessarily acknowledged by the receiver. This is why it does not make sense
to return a number of actual bytes written in case of error since it says nothing about the
number of acked bytes. To ensure that written bytes have been acked, a successful call to
Stream.close() is necessary after last call to this
public func writeAsync(data: Data, closure: @escaping AsyncStatusReceiver)
- the data to write
- Invoked when the operation completes, see synchronous write() for possible errors.
Throws the following errors: