diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 6743a7f81..55c2d4926 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -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(&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