std1.0.0-beta-7 SafeC docs

std :: sched::io_nb

Function std::tcp_connect_nb

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

int tcp_connect_nb(unsigned int addr_network_order, unsigned short port)

socket()+connect(), non-blocking: connect() on a non-blocking socket returns immediately with EINPROGRESS rather than waiting for the handshake — the caller should await_fd(fd, SCHED_WRITE) and treat the fd becoming writable as "connect finished (successfully or not; check SO_ERROR if you need to distinguish)". Returns the socket fd, or -1 on immediate failure.