Skip to content
SocketSetKeepAlive

SocketSetKeepAlive

Description

Toggle SO_KEEPALIVE.

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)
    }
    
    bool SocketSetKeepAlive(SockFd fd, bool keepalive) {
        i32 v = keepalive ? 1 : 0;
        return plat_setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &v, sizeof(v));
Last updated on