如何修改Http中的server_http.hpp文件以在套接字上设置SO_REUSEPORT?或者我怎么才能通过fd。( systemd .socket文件需要ReusePort=yes )。
https://github.com/eidheim/Simple-Web-Server/blob/master/server_http.hpp
发布于 2022-08-09 18:04:53
SO_REUSEPORT在Windows中不存在,因此只有依赖于系统的解决方案:
#include <arpa/inet.h>
/// ...
int opt = 1;
::setsockopt(acceptor.native_handle(), SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt));但总的来说,我认为你应该问问自己,你为什么需要它?
https://stackoverflow.com/questions/73295933
复制相似问题