Function in stdx_network.h

x_net_poll

Wait for specific events on a socket.

int32_t x_net_poll(
 XSocket sock,
 int32_t events,
 int32_t timeout_ms
);

Parameters

XSocket sock
Socket handle.
int32_t events
Bitmask of events to wait for (implementation-defined).
int32_t timeout_ms
Timeout in milliseconds (-1 for infinite, 0 for non-blocking poll).

Returns

Event bitmask of occurred events, 0 on timeout, or -1 on error.

Function in stdx_network.h

x_net_select

Wait for readability on multiple sockets.

int32_t x_net_select(
 XSocket *read_sockets,
 int32_t read_count,
 int32_t timeout_ms
);

Parameters

XSocket *read_sockets
Array of sockets to wait on for readability.
int32_t read_count
Number of sockets in read_sockets.
int32_t timeout_ms
Timeout in milliseconds (-1 for infinite, 0 for non-blocking poll).

Returns

Number of sockets ready for reading, 0 on timeout, or -1 on error.