msgid ""
msgstr ""
"Project-Id-Version: Chinese (Simplified Han script) (Boost Beast Translation "
"(zh_Hans))\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-07-24 18:06+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Chinese (Simplified Han script) <https://"
"insights.cppalliance.org/weblate/projects/boost-beast-documentation-zh_Hans/"
"doc-qbk-06-websocket-08-notes-qbk/zh_Hans/>\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 2026.5\n"

#. type: section title
#: 10
msgid "Notes"
msgstr "记录"

#. type: paragraph
#: 12
msgid ""
"Because calls to read data may return a variable amount of bytes, the "
"interface to calls that read data require an object that meets the "
"requirements of __DynamicBuffer__. This concept is modeled on __streambuf__."
msgstr ""
"由于读取数据的调用可能返回数量不等的字节，因此读取数据的调用接口需要一个满足 "
"__DynamicBuffer__ 要求的对象。该概念基于 __streambuf__ 建模。"

#. type: paragraph
#: 16
msgid ""
"The implementation does not perform queueing or buffering of messages. If "
"desired, these features should be provided by callers. The impact of this "
"design is that library users are in full control of the allocation strategy "
"used to store data and the back-pressure applied on the read and write side "
"of the underlying TCP/IP connection."
msgstr ""
"该实现不执行消息的排队或缓冲操作。如果需要这些功能，应由调用方提供。这种设计"
"的影响是，库用户可以完全控制存储数据的分配策略，以及底层 TCP/IP 连接上读写两"
"侧的背压管理。"

#. type: heading
#: 22
msgid "Asynchronous Operations"
msgstr "异步操作类型"

#. type: paragraph
#: 24
msgid "Asynchronous versions are available for all functions:"
msgstr "所有函数都提供异步版本。"

#. type: paragraph
#: 28
msgid ""
"Calls to asynchronous initiation functions support the extensible "
"asynchronous model developed by the Boost.Asio author, allowing for "
"traditional completion handlers, stackful or stackless coroutines, and even "
"futures:"
msgstr ""
"对异步发起函数的调用支持 Boost.Asio 作者开发的可扩展异步模型，允许使用传统的"
"完成处理器、有栈或无栈协程，甚至 future："

#. type: paragraph
#: 34
msgid ""
"The example programs that come with the library demonstrate the usage of "
"websocket stream operations with all asynchronous varieties."
msgstr "库附带的示例程序展示了 WebSocket 流操作在所有异步变体中的用法。"

#. type: heading
#: 37
msgid "The io_context"
msgstr "I/O 上下文对象"

#. type: paragraph
#: 39
msgid ""
"The creation and operation of the __io_context__ associated with the "
"underlying stream is left to the callers, permitting any implementation "
"strategy including one that does not require threads for environments where "
"threads are unavailable. Beast WebSocket itself does not use or require "
"threads."
msgstr ""
"与底层流关联的 __io_context__ 的创建和操作由调用方负责，允许采用任何实现策略"
"，包括在无线程环境中不需要线程的策略。Beast WebSocket 本身不使用也不要求线程"
"。"

#. type: heading
#: 45
msgid "Thread Safety"
msgstr "线程安全性"

#. type: paragraph
#: 47
msgid ""
"Like a regular __Asio__ socket, a [link "
"beast.ref.boost__beast__websocket__stream `stream`] is not thread safe. "
"Callers are responsible for synchronizing operations on the socket using an "
"implicit or explicit strand, as per the Asio documentation. The websocket "
"stream asynchronous interface supports one of each of the following "
"operations to be active at the same time:"
msgstr ""
"与普通的 Asio 套接字类似，[link beast.ref.boost__beast__websocket__stream "
"stream] 不是线程安全的。调用方需要按照 Asio 文档的要求，使用隐式或显式的串行"
"器来同步套接字操作。WebSocket 流的异步接口支持以下各类操作同时各有一个处于活"
"动状态："

#. type: list
#: 54
msgid ""
"* [link beast.ref.boost__beast__websocket__stream.async_read `async_read`] "
"or [link beast.ref.boost__beast__websocket__stream.async_read_some "
"`async_read_some`]\n"
"* [link beast.ref.boost__beast__websocket__stream.async_write `async_write`] "
"or [link beast.ref.boost__beast__websocket__stream.async_write_some "
"`async_write_some`]\n"
"* [link beast.ref.boost__beast__websocket__stream.async_ping `async_ping`] "
"or [link beast.ref.boost__beast__websocket__stream.async_pong `async_pong`]\n"
"* [link beast.ref.boost__beast__websocket__stream.async_close `async_close`]"
msgstr ""
"* [link beast.ref.boost__beast__websocket__stream.async_read `async_read`] "
"or [link beast.ref.boost__beast__websocket__stream.async_read_some "
"`async_read_some`]\n"
"* [link beast.ref.boost__beast__websocket__stream.async_write `async_write`] "
"or [link beast.ref.boost__beast__websocket__stream.async_write_some "
"`async_write_some`]\n"
"* [link beast.ref.boost__beast__websocket__stream.async_ping `async_ping`] "
"or [link beast.ref.boost__beast__websocket__stream.async_pong `async_pong`]\n"
"* [link beast.ref.boost__beast__websocket__stream.async_close `async_close`]"

#. type: paragraph
#: 59
msgid ""
"For example, the following code is produces undefined behavior, because the "
"program is attempting to perform two simultaneous reads:"
msgstr "例如，以下代码会导致未定义行为，因为程序试图同时执行两个读取操作："

#. type: paragraph
#: 64
msgid "However, this code is correct:"
msgstr "然而，以下代码是正确的："

#. type: paragraph
#: 68
msgid ""
"The implementation uses composed asynchronous operations; although some "
"individual operations can perform both reads and writes, this behavior is "
"coordinated internally to make sure the underlying stream is operated in a "
"safe fashion. This allows an asynchronous read operation to respond to a "
"received ping frame even while a user-initiated call to asynchronous write "
"is active."
msgstr ""
"实现使用组合异步操作。虽然某些操作可能同时涉及读取和写入，但内部会协调这些行"
"为，确保底层流安全运行。因此，即使有用户发起的异步写入操作正在进行，异步读取"
"操作也能正常响应收到的 ping 帧。"
