C++ 速度限制

C++ 速度限制,c++,boost,rate-limiting,boost-beast,C++,Boost,Rate Limiting,Boost Beast,我正在阅读Boost.Beast文档,并试图在代码中使用速率限制: io_context context; tcp::resolver resolver(context); basic_stream<tcp, executor, simple_rate_policy> stream(context); stream.rate_policy().write_limit(1); stream.connect(resolver.resolve("www.exampl

我正在阅读Boost.Beast文档,并试图在代码中使用速率限制:

  io_context context;
  tcp::resolver resolver(context);
  basic_stream<tcp, executor, simple_rate_policy> stream(context);

  stream.rate_policy().write_limit(1);

  stream.connect(resolver.resolve("www.example.com", "http"));

  string response;

  write(stream, buffer("GET /index.html HTTP/1.1\r\nHost: www.example.com\r\n\r\n"));

  read_until(stream, dynamic_buffer(response), "\r\n\r\n");

  cout << response << endl;

  context.run();
io\u上下文;
tcp::解析器解析器(上下文);
基本流(上下文);
stream.rate_policy().write_limit(1);
stream.connect(resolver.resolve(“www.example.com”、“http”);
字符串响应;
写入(流、缓冲区(“GET/index.html HTTP/1.1\r\nHost:www.example.com\r\n\r\n”);
读取直到(流、动态缓冲区(响应),“\r\n\r\n”);

不能限制只适用于异步操作。

文档中有关于它的内容吗?我想在这里提供帮助,但我找到的唯一一件事与超时有关:
出于可移植性的原因,网络不为同步流操作提供超时或取消功能