embedded-framework/utils/TcpModule/readme.md
2024-07-19 17:48:19 +08:00

32 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# TCP模块
这个项目实现了一个用于网络通信的TCP模块提供了服务器和客户端功能。
# 涉及的知识
* 网络通信
* 多线程处理
* 回调函数
* C++/C
* I/O多路复用
* 套接字编程
* TCP协议
# 各文件的作用
* **TcpModule.h**定义了TCP模块的公共接口和数据结构包括服务器和客户端参数结构体、回调函数类型等。
* **TcpModule.cpp**实现了TcpModule.h中定义的接口包括创建和释放TCP服务器和客户端的函数。
* **ITcpClient.h/ITcpClient.cpp**定义和实现了TCP客户端接口包括初始化、读取数据、写入数据和关闭连接等虚函数。
* **ITcpServer.h/ITcpServer.cpp**定义和实现了TCP服务器接口包括初始化、关闭服务器等虚函数。
* **TcpClientImpl.h/TcpClientImpl.cpp**实现了ITcpClient接口是TCP客户端的具体实现。
* **TcpServerImpl.h/TcpServerImpl.cpp**实现了ITcpServer接口是TCP服务器的具体实现。
* **TcpModuleMakePtr.h/TcpModuleMakePtr.cpp**提供了创建TCP服务器和客户端实例的工厂方法。
* **TcpServerHandle.h/TcpServerHandle.cpp**管理TCP服务器的实例提供了添加和获取服务器实例的方法。
* **TcpClientAcceptImpl.h/TcpClientAcceptImpl.cpp**实现了ITcpClientAccept接口处理客户端连接的接受和数据交换。