#pragma once #include #include // Linux socket头文件 #include // 网络地址结构 #include // TCP协议选项 #include // IP地址转换 #include // close函数 #include // 文件控制选项 #include // 错误号 #include // 字符串操作 #include // string类 using namespace std; // 将错误代码转换为可读字符串 string FormatLinkError(int ErrorCode); // 安全关闭套接字 int CLOSESOCKET(int& s); // 设置TCP keep-alive选项 int socket_set_keepalive(int fd);