主要修改: - 修复HttpServer.cpp中的乱码注释导致的编译错误 - 转换文件为CRLF行尾符,添加UTF-8 BOM确保Visual Studio兼容性 - 增强Socket超时处理:添加接收/发送超时30秒配置 - 更新Config.h添加SOCKET_RECV_TIMEOUT_MS和SOCKET_SEND_TIMEOUT_MS常量 - 完善异常处理机制,确保服务线程稳定性 技术细节: - 解决乱码注释:OPTIONS预检请求处理、查找路由处理器等10处注释 - 网络稳定性:防止recv/send操作无限阻塞导致服务不响应 - 文件编码标准化:符合项目其他文件的编码规范 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
794 B
C++
28 lines
794 B
C++
#pragma once
|
|
|
|
// 系统配置常量
|
|
class Config {
|
|
public:
|
|
// 端口配置
|
|
static const int HTTP_PORT = 12345;
|
|
static const int WEBSOCKET_PORT = 12346;
|
|
|
|
// API配置
|
|
static constexpr const char* API_PREFIX = "/api";
|
|
|
|
// 超时配置
|
|
static const int HTTP_TIMEOUT_MS = 30000; // 30秒
|
|
static const int WEBSOCKET_TIMEOUT_MS = 300000; // 5分钟
|
|
static const int SOCKET_RECV_TIMEOUT_MS = 30000; // Socket接收超时30秒
|
|
static const int SOCKET_SEND_TIMEOUT_MS = 30000; // Socket发送超时30秒
|
|
|
|
// 缓冲区大小
|
|
static const int BUFFER_SIZE = 4096;
|
|
|
|
// Creo配置
|
|
static const int CREO_CHECK_INTERVAL_MS = 100; // 检查间隔
|
|
|
|
private:
|
|
Config() = delete; // 禁止实例化
|
|
};
|