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