浏览代码

Merge pull request #503 from paullouisageneau/fix-wss-getaddrinfo-flags

Fix WebSocketServer listening address
Paul-Louis Ageneau 4 年之前
父节点
当前提交
a0f79fed1b
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/impl/tcpserver.cpp

+ 1 - 1
src/impl/tcpserver.cpp

@@ -103,7 +103,7 @@ void TcpServer::listen(uint16_t port) {
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_protocol = IPPROTO_TCP;
 	hints.ai_protocol = IPPROTO_TCP;
-	hints.ai_flags = AI_ADDRCONFIG;
+	hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV;
 
 
 	struct addrinfo *result = nullptr;
 	struct addrinfo *result = nullptr;
 	if (::getaddrinfo(nullptr, std::to_string(port).c_str(), &hints, &result))
 	if (::getaddrinfo(nullptr, std::to_string(port).c_str(), &hints, &result))