diff --git a/src/viewer/svutil.cpp b/src/viewer/svutil.cpp index 7fe6825988..3acce98040 100644 --- a/src/viewer/svutil.cpp +++ b/src/viewer/svutil.cpp @@ -273,8 +273,6 @@ SVNetwork::SVNetwork(const char *hostname, int port) { buffer_ptr_ = nullptr; - struct addrinfo *addr_info = nullptr; - struct addrinfo hints = {0, PF_INET, SOCK_STREAM}; auto port_string = std::to_string(port); # ifdef _WIN32 // Initialize Winsock @@ -285,6 +283,10 @@ SVNetwork::SVNetwork(const char *hostname, int port) { } # endif // _WIN32 + struct addrinfo *addr_info = nullptr; + struct addrinfo hints = {}; + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; if (getaddrinfo(hostname, port_string.c_str(), &hints, &addr_info) != 0) { std::cerr << "Error resolving name for ScrollView host " << std::string(hostname) << ":" << port << std::endl;