Closed alexliyu7352 closed 7 months ago
感觉你的改法有点绕啊,有没有必要改成这样:
#if !defined(SOCKET_DEFAULT_BUF_SIZE)
#define SOCKET_DEFAULT_BUF_SIZE 256 * 1024
#endif
if(DEFINED SOCKET_DEFAULT_BUF_SIZE)
add_definitions(-DSOCKET_DEFAULT_BUF_SIZE=${SOCKET_DEFAULT_BUF_SIZE})
endif()
就是在cmake中不指定宏 就默认设置下。
感觉你的改法有点绕啊,有没有必要改成这样:
#if !defined(SOCKET_DEFAULT_BUF_SIZE) #define SOCKET_DEFAULT_BUF_SIZE 256 * 1024 #endif
if(DEFINED SOCKET_DEFAULT_BUF_SIZE) add_definitions(-DSOCKET_DEFAULT_BUF_SIZE=${SOCKET_DEFAULT_BUF_SIZE}) endif()
就是在cmake中不指定宏 就默认设置下。
的确哦, 这是很早之前的, 我是从之前项目直接复制过来了, 抱歉哈... 我改改
The default buffer size of a socket should not be hardcoded in the program; it should be configurable. Additionally, in Linux, adjusting kernel parameters can be more effective in improving the performance or throughput of a program in scenarios such as high-latency "long fat networks" or high-concurrency situations, compared to using setsockopt.