Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
Before data can be exchanged, the stream needs to be connected to a peer. The following code sets a timeout for an asynchronous connect operation. In Beast, functions to connect to a range of endpoints (such as the range returned by [@boost:/doc/html/boost_asio/reference/ip__basic_resolver/resolve/overload3.html `net::ip::tcp::resolver::resolve`]) are members of the class rather than free functions such as [@boost:/doc/html/boost_asio/reference/async_connect.html `net::async_connect`].在交换数据之前,该流需要先连接到对等端。以下代码用于为异步连接操作设置超时时间。在 Beast 中,用于连接端点范围(例如由 net::ip::tcp::resolver::resolve 返回的范围)的函数属于该类的成员函数,而不是像 net::async_connect 那样的自由函数。