Skip to content

Commit c66d977

Browse files
sfan5SmallJoker
authored andcommittedJun 22, 2018
Fix ipv6_server=true not accepting IPv4 connections on Windows (#7471)
1 parent b308cb6 commit c66d977

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/network/socket.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ bool UDPSocket::init(bool ipv6, bool noExceptions)
118118

119119
setTimeoutMs(0);
120120

121+
if (m_addr_family == AF_INET6) {
122+
// Allow our socket to accept both IPv4 and IPv6 connections
123+
// required on Windows:
124+
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx
125+
int value = 0;
126+
setsockopt(m_handle, IPPROTO_IPV6, IPV6_V6ONLY,
127+
reinterpret_cast<char *>(&value), sizeof(value));
128+
}
129+
121130
return true;
122131
}
123132

0 commit comments

Comments
 (0)
Please sign in to comment.