SocketSetRecvTimeoutMs
Description
Cap how long a single recv call may block, in milliseconds.
Success
Returns true. The fd has the requested timeout.
Failure
Returns false. The fd is unchanged; the failing syscall is logged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Dns.c:493:
return -1;
}
if (!SocketSetRecvTimeoutMs(sock.fd, timeout_ms)) {
SocketClose(&sock);
return -1;- In
Socket.c:932:
}
bool SocketSetRecvTimeoutMs(SockFd fd, u32 ms) {
#if PLATFORM_WINDOWS
DWORD tv = (DWORD)ms;- In
Socket.c:1360:
// ms/1000 and (ms%1000)*1000 arms of the conversion). The kernel
// rejects a malformed timeval, so a broken conversion -> false.
ok = ok && SocketSetRecvTimeoutMs(server.fd, 1500);
// Data is available, so the recv returns immediately with the bytes
Last updated on