Stream.writeAsync()

DESCRIPTION

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 Stream.write().

DECLARATION

    public func writeAsync(data: Data, closure: @escaping AsyncStatusReceiver) 

PARAMETERS

data:
the data to write
closure:
Invoked when the operation completes, see synchronous write() for possible errors.

ERRORS

Throws the following errors:

None.

RETURN VALUES

None.

EXAMPLES

None.