tnie / aclient Goto Github PK
View Code? Open in Web Editor NEW使用 asio 异步方式进行简单的 http get 或 post 请求
使用 asio 异步方式进行简单的 http get 或 post 请求
https://www.boost.org/doc/libs/1_76_0/doc/html/boost_asio/reference/Executor1.html
能够执行 callable thing 就是 Executor
https://www.boost.org/doc/libs/1_76_0/doc/html/boost_asio/reference/ExecutionContext.html
从 execution_context
类型继承,拥有自身的 executor_type 即可。
The thread pool class is an execution context where functions are permitted to run on one of a fixed number of threads.
class io_context :
public execution_context
class thread_pool :
public execution_context
class system_context :
public execution_context
一个“万能”的类型:any_io_executor
如果没有上述类型,也不支持 auto
变量类型自动推导,呵呵,参考 Stopping the io_context from running out of work c++03 的例子
参考 libunifex与executors for C++23前瞻
在 asio 中,execution context 是一个重量级的对象,不允许拷贝。executor 是对一个轻量级的句柄(handle)对象指向对应的execution context。
在 aclient.cpp 中 ,而asio::executor executor = co_await asio::this_coro::executor;
正确
在 echo.cpp 中编译失败,返回类型改用 auto executor =
才可以。所以,返回类型到底是什么?
awaitable
类型,定义在 <asio\awaitable.hpp> 中:
The return type of a coroutine or asynchronous operation.
The parser automatically removes the chunked transfer coding when it is the last encoding in the list.
How to decompress gzip encoded response properly?
Beast only removes the chunk-encoding. You are responsible for everything else, including gzip.
正确执行。但如何理解呢?
[2021-03-24 16:22:03.660] [9200] [info] waiting 1s ...
[2021-03-24 16:22:04.662] [5616] [info] hello coro @use_coro.
[2021-03-24 16:22:04.662] [5616] [info] iox 2 handlers were executed
[2021-03-24 16:22:04.663] [12104] [info] ioc 1 handlers were executed
请按任意键继续. . .
调用 use_coro_handler() 崩溃
ping(呯)是一种计算机网络工具,用来测试数据包能否透过 IP 协议到达特定主机。ping 的运作原理是向目标主机传出一个 ICMP 的请求回显数据包,并等待接收回显回应数据包。
互联网控制消息协议(英语:Internet Control Message Protocol,缩写:ICMP)是互联网协议族的核心协议之一。它用于网际协议(IP)中发送控制消息,提供可能发生在通信环境中的各种问题反馈。
telent
DNS
DNS 协议可以使用 UDP 或者 TCP 进行传输,使用的端口号都为 53。但大多数情况下 DNS 都使用 UDP 进行传输。
tcp
udp
访问 https://www.baidu.com 时,是否增加此属性,结果存在区别:服务端主动降级 http
results_type resolve(
const protocol_type & protocol,
string_view host,
string_view service);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.