std :: sched::io_nb
Function std::sock_set_io_timeout
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.