std1.0.0-beta-7 SafeC docs

std :: sched::io_nb

Function std::sock_set_io_timeout

#include <std/sched/io_nb.h> source · definition

int sock_set_io_timeout(int fd, int timeout_ms)

Sets SO_RCVTIMEO and SO_SNDTIMEO on a blocking socket, so that a single read/write that makes no progress for 'timeout_ms' fails (-1, EAGAIN/ EWOULDBLOCK, or WSAETIMEDOUT on Windows) instead of blocking forever. It bounds each call, not a whole request. 'timeout_ms' <= 0 clears both timeouts. Returns 0 on success.