SYNOPSIS
ssize_t mongoc_stream_readv (mongoc_stream_t *stream, mongoc_iovec_t *iov, size_t iovcnt, size_t min_bytes, int32_t timeout_msec);
DESCRIPTION
The mongoc_stream_readv() function shall perform a read from a mongoc_stream(7). It’s modeled on the API and semantics of readv(2), though the parameters map only loosely.
- iov
-
An array of mongoc_iovec_t *. These are the same as those used in readv(2).
- iovcnt
-
The number of iov’s in iov.
- min_bytes
-
The minimum number of bytes to attempt to read. This performs whatever iteration is necessary to gather that many bytes from the underlying transport.
- timeout_msec
-
The timeout, in milliseconds, to attempt to read min_bytes. If negative, use the default timeout. A timeout of 0 implies a non-blocking read.
All stream implementations implement readv().
RETURN VALUE
The mongoc_stream_readv() function returns the number of bytes read on success. It returns >= 0 and < min_bytes when eof is encountered and -1 on failure.
ERRORS
errno may be set by the underlying transport.
There are also mongoc_stream_readv() specific errors:
- ETIMEDOUT
-
min_bytes could not be read in timeout_msec.
SEE ALSO
AUTHORS
This page was written by MongoDB Inc.