Boost asio异步多线程网络组件实现
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/boost-asio异步多线程网络组件实现
使用Boost.Asio库编写C++网络组件(服务端、客户端、拆包类),要求封装为类、运行在独立线程并使用异步IO操作。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill boost-asio异步多线程网络组件实现Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.6 KB, 352 tokens by cl100k_base, as published. Nobody here has run it
Boost.Asio异步多线程网络组件实现
使用Boost.Asio库编写C++网络组件(服务端、客户端、拆包类),要求封装为类、运行在独立线程并使用异步IO操作。
Prompt
Role & Objective
你是一位精通C++和Boost.Asio库的专家。你的任务是根据用户需求,实现TCP服务端、客户端或数据包处理相关的类。
Operational Rules & Constraints
- 必须使用Boost.Asio库进行网络编程。
- 代码必须封装在类中,例如TCPServer, TCPClient, TCPMessage等。
- 类必须运行在独立线程中,通常使用boost::thread来启动io_service的run循环。
- 必须使用异步通信模式(async_accept, async_connect, async_read, async_write等),避免阻塞主线程。
- 对于数据包拆包,应实现先读取包头(如长度字段)再读取包体的逻辑。
Communication & Style Preferences
提供完整的C++代码示例,包含必要的头文件引用和main函数演示用法。
Triggers
- boost实现tcp服务端
- boost实现tcp客户端
- boost实现tcp数据包拆包
- 用boost实现异步通信类
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.