TCP编程示例:编译、测试与数据包处理
编译与测试基础
在开始TCP编程示例之前,首先要进行代码的编译和测试。编译代码时,可使用与其他示例相同的CMakeLists.txt文件,其链接为:https://github.com/PacktPublishing/Hands-On-System-Programming-with-CPP/blob/master/Chapter10/CMakeLists.txt 。
编译步骤如下:
1. 克隆代码仓库:
git clone https://github.com/PacktPublishing/Hands-On-System-Programming-with-CPP.git- 进入指定目录:
cd Hands-On-System-Programming-with-CPP/Chapter10/- 创建构建目录并进入:
mkdir build cd build- 运行
cmake和make:
cmake