From fbfff23923697eefa03c9398b61d0cd8d89a21cf Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 7 May 2012 13:58:22 +0200 Subject: [PATCH] Bugfix for TCPSocket::Bind() --- base/tcpsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/tcpsocket.cpp b/base/tcpsocket.cpp index d242ab8e6..9f08ae2f0 100644 --- a/base/tcpsocket.cpp +++ b/base/tcpsocket.cpp @@ -28,12 +28,12 @@ void TCPSocket::Bind(string node, string service, int family) addrinfo *result; memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; + hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; - if (getaddrinfo(node.c_str(), service.c_str(), &hints, &result) < 0) { + if (getaddrinfo(node.empty() ? NULL : node.c_str(), service.c_str(), &hints, &result) < 0) { HandleSocketError(); return; -- 2.50.1