Browse Source

Clarify Windows SO_REUSEADDR exception

tags/v1.4.90
Pierre Ossman 9 years ago
parent
commit
056c153209
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      common/network/TcpSocket.cxx

+ 6
- 1
common/network/TcpSocket.cxx View File

} }
#endif /* defined(IPV6_V6ONLY) */ #endif /* defined(IPV6_V6ONLY) */


#ifndef WIN32
#ifdef FD_CLOEXEC
// - By default, close the socket on exec() // - By default, close the socket on exec()
fcntl(sock, F_SETFD, FD_CLOEXEC); fcntl(sock, F_SETFD, FD_CLOEXEC);
#endif


// SO_REUSEADDR is broken on Windows. It allows binding to a port
// that already has a listening socket on it. SO_EXCLUSIVEADDRUSE
// might do what we want, but requires investigation.
#ifndef WIN32
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char *)&one, sizeof(one)) < 0) { (char *)&one, sizeof(one)) < 0) {
int e = errorNumber; int e = errorNumber;

Loading…
Cancel
Save