An asio TCP socket with an associated streambuf buffer for receiving lines of text, as well as string buffers for sending responses.
More...
Inherits asio::ip::tcp::socket, and std::enable_shared_from_this< buffered_socket_t >.
|
asio::streambuf & | get_buffer () |
| Access to associated streambuf. More...
|
|
void | queue_write (const std::string &message) |
| Send the given message through this connection to the client asynchronously. More...
|
|
|
asio::streambuf | streambuf |
| associated streambuf object to collect received pieces into lines More...
|
|
std::string | current_message |
| The message that is currently sent back to the client. More...
|
|
std::string | next_message |
| A buffer for the next message(s) that must be sent back to the client after the sending of current_message has completed. More...
|
|
An asio TCP socket with an associated streambuf buffer for receiving lines of text, as well as string buffers for sending responses.
Used for communicating with MHA TCP clients. The life time of the connection objects is managed with shared pointers registered together with callbacks in the asio event loop. This is a common idiom in asio. To support this, we inherit from enable_shared_from_this which is also common in code that uses asio.
◆ get_buffer()
asio::streambuf& mha_tcp::buffered_socket_t::get_buffer |
( |
| ) |
|
|
inline |
Access to associated streambuf.
Needed to invoke async_read.
- Returns
- associated streambuf object by reference
◆ queue_write()
void mha_tcp::buffered_socket_t::queue_write |
( |
const std::string & |
message | ) |
|
Send the given message through this connection to the client asynchronously.
- Parameters
-
message | The text to send. Method copies the message before returning. |
◆ streambuf
asio::streambuf mha_tcp::buffered_socket_t::streambuf |
|
private |
associated streambuf object to collect received pieces into lines
◆ current_message
std::string mha_tcp::buffered_socket_t::current_message |
|
private |
The message that is currently sent back to the client.
◆ next_message
std::string mha_tcp::buffered_socket_t::next_message |
|
private |
A buffer for the next message(s) that must be sent back to the client after the sending of current_message has completed.
The documentation for this class was generated from the following files: