SocketSetReuseAddr
Description
Allow a listening socket to reclaim a port still in TIME_WAIT. Maps to SO_REUSEADDR on POSIX and SO_EXCLUSIVEADDRUSE on Windows – Windows’s SO_REUSEADDR lets other processes hijack the port, which is the opposite of what callers want. The shim normalises both to “let me restart the server quickly without ADDRINUSE from TIME_WAIT” semantics.
Success
Returns true. The fd has the requested setting.
Failure
Returns false. The fd is unchanged; the failing syscall is logged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Socket.c:1076:
}
bool SocketSetReuseAddr(SockFd fd, bool reuse) {
i32 v = reuse ? 1 : 0;
#if PLATFORM_WINDOWS
Last updated on