NetSock_Sel() / select() (TCP/UDP)
Check if any sockets are ready for available read or write operations or error conditions.
Files
net_sock.h/net_sock.c
net_bsd.h/net_bsd.c
Prototypes
...
Arguments
sock_nbr_max
Specifies the maximum number of socket file descriptors in the file descriptor sets.
...
Pointer to a set of socket file descriptors to:
- Check for available read operations.
- Returns the actual socket file descriptors ready for available read operations, if no errors;
- Returns the initial, non-modified set of socket file descriptors, on any errors;
- Returns a null-valued (i.e., zero-cleared) descriptor set, if any timeout expires.
psock_desc_wr
Pointer to a set of socket file descriptors to:
- Check for available read operations.
- Returns the actual socket file descriptors ready for available write operations, if no errors;
- Returns the initial, non-modified set of socket file descriptors, on any errors;
- Returns a null-valued (i.e., zero-cleared) descriptor set, if any timeout expires.
psock_desc_err
Pointer to a set of socket file descriptors to:
- Check for any available socket errors.
- Returns the actual socket file descriptors ready with any pending errors;
- Returns the initial, non-modified set of socket file descriptors, on any errors;
- Returns a null-valued (i.e., zero-cleared) descriptor set, if any timeout expires.
ptimeout
Pointer to a timeout argument.
...
Pointer to variable that will receive the error code from this function:
NET_SOCK_ERR_NONE
NET_SOCK_ERR_TIMEOUT
NET_ERR_INIT_INCOMPLETE
NET_SOCK_ERR_INVALID_DESC
NET_SOCK_ERR_INVALID_TIMEOUT
NET_SOCK_ERR_INVALID_SOCK
NET_SOCK_ERR_INVALID_TYPE
NET_SOCK_ERR_NOT_USED
NET_SOCK_ERR_EVENTS_NBR_MAX
NET_OS_ERR_LOCK
Returned Value
Returns the number of sockets ready with available operations, if successful;
...
NET_SOCK_BSD_ERR_SEL/-1
, otherwise.
Required Configuration
NetSock_Sel()
is available only if either NET_CFG_TRANSPORT_LAYER_SEL
is configured for TCP (see section D-12-1) and/or NET_UDP_CFG_APP_API_SEL
is configured for sockets (see section D-13-1) and if NET_SOCK_CFG_SEL_EN
is enabled (see section D-15-4).
In addition, select()
is available only if NET_BSD_CFG_API_EN
is enabled (see section D-17-1).
Notes / Warnings
Supports socket file descriptors only (i.e., socket ID numbers).
...