asio C++ library

PrevUpHomeNext

read_until (22 of 24 overloads)

Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression.

template<
    typename SyncReadStream,
    typename DynamicBuffer_v2,
    typename Traits>
std::size_t read_until(
    SyncReadStream & s,
    DynamicBuffer_v2 buffers,
    const boost::basic_regex< char, Traits > & expr,
    asio::error_code & ec,
    constraint_t< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >  = 0);

This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:

This operation is implemented in terms of zero or more calls to the stream's read_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.

Parameters

s

The stream from which the data is to be read. The type must support the SyncReadStream concept.

buffers

A dynamic buffer sequence into which the data will be read.

expr

The regular expression.

ec

Set to indicate what error occurred, if any.

Return Value

The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.

Remarks

After a successful read_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read_until operation to examine.


PrevUpHomeNext