Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
websocket::stream::read (1 of 2 overloads)

Read a message.

Synopsis
template<
    class DynamicBuffer>
std::size_t
read(
    DynamicBuffer& buffer);
Description

This function is used to synchronously read a complete message from the stream. The call blocks until one of the following is true:

This operation is implemented in terms of one or more calls to the next layer's read_some and write_some functions.

Received message data, if any, is appended to the input area of the buffer. The functions websocket::stream::got_binary and websocket::stream::got_text may be used to query the stream and determine the type of the last received message.

While this operation is active, the implementation will read incoming control frames and handle them automatically as follows:

Return Value

The number of message payload bytes appended to the buffer.

Parameters

Name

Description

buffer

A dynamic buffer to hold the message data after any masking or decompression has been applied.

Exceptions

Type

Thrown On

system_error

Thrown to indicate an error. The corresponding error code may be retrieved from the exception object for inspection.


PrevUpHomeNext