nabto_client_stream_write()
DESCRIPTION
Write bytes to a stream.
When the future resolves the data is only written to the stream, but not neccessary acknowledged. 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 succesful call to nabto_client_stream_close is neccessary after last call to nabto_client_stream_write.
Future status:
- NABTO_CLIENT_EC_OK if write was ok, the buffer is fully copied into the streaming buffers, but not neccessarily sent or acknowledgeg by the other end yet.
- NABTO_CLIENT_EC_CLOSED if the stream is closed for writing.
- NABTO_CLIENT_EC_STOPPED if the stream is stopped.
- NABTO_CLIENT_EC_OPERATION_IN_PROGRESS if another write is in progress.
DECLARATION
NABTO_CLIENT_DECL_PREFIX void NABTO_CLIENT_API
nabto_client_stream_write(NabtoClientStream* stream, NabtoClientFuture* future, const void* buffer, size_t bufferLength)
PARAMETERS
stream:
- [in] The stream to write data to.
future:
- [in] The future that resolves when the write completes or fails.
buffer:
- [in] The input buffer with data to write to the stream, the buffer needs to be kept alive until the future returns.
bufferLenth:
- [in], length of the input data.