Header must have a public length field allowing the payload length to be get/set.
Handlers should override connected (inherited from net_handler); incoming_message(const Header&, databuf) to read messages; and end_messages(unsigned int) to be notified of stream closure.
Public Methods | |
bool | write (Header &head, const omessage &p) |
Populates the header with the payload length and writes a message. | |
bool | write (Header &head, constbuf payload) |
Populates the header with the payload length and writes a message. | |
bool | write (const Header &head, const omessage &p) |
Copies the header, populates it with the payload length, and writes a message. | |
bool | write (const Header &head, constbuf payload) |
Populates the header with the payload length and writes a message. | |
bool | write (const Header &head) |
Writes a message with no payload. | |
bool | write (constbuf payload) |
Writes a message with a default-constructed header. | |
bool | write (string payload) |
Writes a message with a default-constructed header. | |
bool | write_asis (const Header &p, constbuf payload) |
Writes a message without setting the payload length (use this only if the payload length is known to have been set properly). | |
Protected Methods | |
msg_handler (io_event_loop &loop, iohandle ioh, bool established=false) | |
msg_handler (io_event_loop &loop) | |
virtual | ~msg_handler () |
virtual void | incoming_message (const Header &head, constbuf buf)=0 |
Invoked when a complete message has been received. | |
virtual void | end_messages (unsigned int remaining) |
Invoked when the stream has been closed for reading, i.e., there cannot possibly be more incoming messages. |
|
|
|
|
|
|
|
Invoked when the stream has been closed for reading, i.e., there cannot possibly be more incoming messages.
|
|
Invoked when a complete message has been received.
|
|
Writes a message with a default-constructed header.
Reimplemented from net_handler< Lock >. |
|
Writes a message with a default-constructed header.
Reimplemented from net_handler< Lock >. |
|
Writes a message with no payload.
|
|
Populates the header with the payload length and writes a message.
|
|
Copies the header, populates it with the payload length, and writes a message.
|
|
Populates the header with the payload length and writes a message.
|
|
Populates the header with the payload length and writes a message.
|
|
Writes a message without setting the payload length (use this only if the payload length is known to have been set properly).
|