Reuse socket address also on BSD.

This commit is contained in:
Bartosz Taudul 2019-11-21 20:38:15 +01:00
parent 37eef59d54
commit 3e4913dc8a

View File

@ -310,6 +310,8 @@ bool ListenSocket::Listen( int port, int backlog )
#elif defined BSD
int val = 0;
setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );
val = 1;
setsockopt( m_sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof( val ) );
#else
int val = 1;
setsockopt( m_sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof( val ) );