NetSock_Sel
Check if any sockets are ready for available read or write operations or error conditions.
Files
net_sock.h/net_sock.cnet_bsd.h/net_bsd.c
Prototypes
NET_SOCK_RTN_CODE NetSock_Sel(NET_SOCK_QTY sock_nbr_max,
NET_SOCK_DESC *p_sock_desc_rd,
NET_SOCK_DESC *p_sock_desc_wr,
NET_SOCK_DESC *p_sock_desc_err,
NET_SOCK_TIMEOUT *p_timeout,
NET_ERR *p_err);
int select ( int desc_nbr_max,
struct fd_set *p_desc_rd,
struct fd_set *p_desc_wr,
struct fd_set *p_desc_err,
struct timeval *p_timeout);Arguments
sock_nbr_max
Specifies the maximum number of socket file descriptors in the file descriptor sets.
p_sock_desc_rd
Pointer to a set of socket file descriptors to:
p_sock_desc_wr
Pointer to a set of socket file descriptors to:
p_sock_desc_err
Pointer to a set of socket file descriptors to:
p_timeout
Pointer to a timeout argument.
p_err
Pointer to variable that will receive the error code from this function:
NET_SOCK_ERR_NONENET_SOCK_ERR_TIMEOUTNET_INIT_ERR_NOT_COMPLETEDNET_SOCK_ERR_INVALID_DESCNET_SOCK_ERR_INVALID_TIMEOUTNET_SOCK_ERR_INVALID_SOCKNET_SOCK_ERR_INVALID_TYPENET_SOCK_ERR_NOT_USEDNET_SOCK_ERR_EVENTS_NBR_MAXNET_ERR_FAULT_LOCK_ACQUIRE
Returned Value
Returns the number of sockets ready with available operations, if successful;
NET_SOCK_BSD_RTN_CODE_TIMEOUT/0, upon timeout;
NET_SOCK_BSD_ERR_SEL/-1, otherwise.
Required Configuration
Available only if NET_SOCK_CFG_SEL_EN is enabled (see section Socket Layer Configuration).
Notes / Warnings
Supports socket file descriptors only (i.e., socket ID numbers).
The descriptor macro’s is used to prepare and decode socket file descriptor sets (see macro functions in section Network Socket Functions).
See “net_sock.c NetSock_Sel() Note #3” for more details.