z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


selectex()

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

The selectex() call provides an extension to the select() call by allowing you to use an ECB or ECB list that defines an event not described by readfs, writefds, or exceptfds.

The selectex() call monitors activity on a set of different sockets until a timeout expires to see whether any sockets are ready for reading or writing, or if any exception conditions are pending. See select() for more information about selectex().

#include <manifest.h>
#include <socket.h>
#include <bsdtypes.h>
#include <bsdtime.h>
 
int selectex(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout, int *ecbptr)
Parameter
Description
nfds
The number of socket descriptors to be checked.
readfds
Points to a bit set of descriptors to be checked for reading.
writefds
Points to a bit set of descriptors to be checked for writing.
exceptfds
Points to a bit set of descriptors to be checked for exception pending conditions.
timeout
Points to the time to wait for selectex() to complete.
ecbptr
Points to the event control block (ECB) or ECB list. For an ECB list, the high-order bit must be turned on in ecbptr. The last entry in the ECB list must also have its high-order bit set to 1, signifying list end. The maximum ECBs allowed is 63.
Note: ECB list is supported only for AF_INET sockets.

Return values

The total number of ready sockets (in all bit sets) is returned. The returned value -1 indicates an error. The returned value of 0 indicates either an expired time limit or that the caller ECB has been posted. To determine which of these two conditions occurred, check the ECB value. If the value of the ECB is nonzero, then the ECB has been POSTed; otherwise, the time limit has expired. The caller must initialize the ECB value to 0 before issuing selectex(). If the caller's ECB has been POSTed, the caller descriptor sets are also set to 0. If the return value is greater than 0, the socket descriptors in each bit set that are ready are set to 1. All others are set to 0.
Errno
Description
EBADF
One of the descriptor sets specified an incorrect descriptor.
EFAULT
One of the parameters pointed to a value outside the caller address space.
EINVAL
One of the fields in the timeval structure is not valid.
Note: If the number of ready sockets is greater than 65535, only 65535 is reported.

Related calls

accept(), connect(), getdtablesize(), recv(), send(), select()

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014