nabto_client_stream_read_all()

DESCRIPTION

Read exactly n bytes from a stream.

If (readLength != bufferLength), the stream has reached a state where the amount of bytes specified by bufferLength could NOT be read. The amount of bytes which could be read is copied to the buffer and readLength is less than bufferLength In any subsequent invocation, NABTO_CLIENT_EC_EOF will be returned.

Future status:

  • NABTO_CLIENT_EC_OK if all or some data was read
  • NABTO_CLIENT_EC_EOF if the stream is eof
  • NABTO_CLIENT_EC_STOPPED if the stream is stopped
  • NABTO_CLIENT_EC_OPERATION_IN_PROGRESS if another read is in progress.

DECLARATION

NABTO_CLIENT_DECL_PREFIX void NABTO_CLIENT_API
nabto_client_stream_read_all(NabtoClientStream* stream, NabtoClientFuture* future, void* buffer, size_t bufferLength, size_t* readLength)

PARAMETERS

stream:
[in] The stream to read bytes from.
future:
[in] The future that resolves when the read completes or fails.
buffer:
[out] The buffer to put data into. It needs to be kept available until the future resolves.
bufferLength:
[in] The length of the output buffer.
readLength:
[out] The actual number of bytes read. It needs to be kept available until the future resolves.