Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
Messages may also be read asynchronously. When performing asynchronous stream read operations the stream, buffer, and message variables must remain valid until the operation has completed. Beast asynchronous initiation functions use Asio's completion handler model. This call reads a message asynchronously and reports the error code upon completion. The handler is called with the error, set to any that occurs, and the number of bytes parsed. This number may be used to measure the relative amount of work performed, or it may be ignored as this example shows.消息也支持异步读取。在执行异步流读操作期间,流对象、缓冲区和消息变量必须保持有效,直到操作完成。Beast 的异步发起函数采用 Asio 的完成处理器模型。该调用会异步读取消息,并在操作完成时将错误码传递给处理器。处理器被调用时,会收到发生的错误和已解析的字节数。这个字节数可以用于衡量相对的工作量,也可以像示例中那样直接忽略。