fixing setsockopt for windows
fsfw/fsfw/pipeline/head This commit looks good Details

This commit is contained in:
Ulrich Mohr 2023-02-09 14:04:42 +01:00
parent 99896f2695
commit b1160cfb2e
1 changed files with 10 additions and 0 deletions

View File

@ -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