fixing setsockopt for windows
This commit is contained in:
parent
99896f2695
commit
b1160cfb2e
@ -92,12 +92,22 @@ ReturnValue_t TcpTmTcServer::initialize() {
|
||||
}
|
||||
|
||||
if (tcpConfig.reuseAddr) {
|
||||
#ifdef PLATFORM_WIN
|
||||
DWORD enable = 1;
|
||||
setsockopt(listenerTcpSocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&enable),
|
||||
sizeof(enable));
|
||||
#elif defined(PLATFORM_UNIX)
|
||||
unsigned int enable = 1;
|
||||
setsockopt(listenerTcpSocket, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (tcpConfig.reusePort) {
|
||||
// Not supported in windows
|
||||
#ifdef PLATFORM_UNIX
|
||||
unsigned int enable = 1;
|
||||
setsockopt(listenerTcpSocket, SOL_SOCKET, SO_REUSEPORT, &enable, sizeof(enable));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Bind to the address found by getaddrinfo
|
||||
|
Loading…
x
Reference in New Issue
Block a user