From 5cd0cad664850c12c2a415f24c43a4cfabeae91c Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 11 Oct 2024 22:57:11 -0700 Subject: [PATCH] fix a typo in the family check for tcp client --- RosaServer/tcpclient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RosaServer/tcpclient.cpp b/RosaServer/tcpclient.cpp index 7971d25..c86c509 100644 --- a/RosaServer/tcpclient.cpp +++ b/RosaServer/tcpclient.cpp @@ -81,7 +81,9 @@ TCPClient::TCPClient(std::string_view address, std::string_view port) { for (addrIter = resultAddress; addrIter != nullptr; addrIter = resultAddress->ai_next) { auto family = addrIter->ai_family; - if (family != AF_INET && family != AF_INET) continue; + if (family == AF_UNSPEC) { + family = AF_INET; + } socketDescriptor = socket(family, SOCK_STREAM | SOCK_NONBLOCK, 0); if (socketDescriptor == -1) continue;