Code Monkey home page Code Monkey logo

aclient's People

Watchers

 avatar  avatar

aclient's Issues

context 和 executor 分别是什么概念

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。

co_await asio::this_coro::executor 返回值类型是什么

在 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.

常用命令或协议

ping 维基

ping(呯)是一种计算机网络工具,用来测试数据包能否透过 IP 协议到达特定主机。ping 的运作原理是向目标主机传出一个 ICMP 的请求回显数据包,并等待接收回显回应数据包。

ICMP 维基

互联网控制消息协议(英语:Internet Control Message Protocol,缩写:ICMP)是互联网协议族的核心协议之一。它用于网际协议(IP)中发送控制消息,提供可能发生在通信环境中的各种问题反馈。

telent
DNS

DNS 协议可以使用 UDP 或者 TCP 进行传输,使用的端口号都为 53。但大多数情况下 DNS 都使用 UDP 进行传输。

tcp
udp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.