Function SocketSelect() Professional

Determines the status of one or more sockets and waits, if necessary.

SocketSelect( [<nReadFD>]  , ;
              [<nWriteFD>] , ;
              [<nExceptFD>], ;
              [<aTimeOut>] , ;
              [@<nError>]    ) --> nNumberOfSockets
Numeric handle of a descriptor set of sockets to be checked for readability.
Numeric handle of a descriptor set of sockets to be checked for writability.
Numeric handle of a descriptor set of sockets to be checked for exceptions.
<aTimeOut> := { nSeconds, nMicroSeconds }
The maximum time for the function to wait can be specified as an array with two elements. The first element is an integer number specifying the seconds, and the second element specifies a timeout period in microseconds.
If this parameter is passed by reference to the function, it gets assigned a numeric error code when the function fails. #define constants beginning with WSAE are available in the file SOCKET.CH to identify an error condition.

The function returns the total number of sockets that are ready and contained in the descriptor sets, or zero if the time limit expired. When an error occurs, a value of SOCKET_ERROR is returned.


This function monitors activity on groups of sockets to see if any sockets are ready for reading or writing, or if exceptional messages are pending (out-of-band data). Sockets are grouped by descriptor sets whose handles must be provided as parameters.

The parameter <nReadFD> identifies those sockets of the descriptor set which are to be checked for readability. Readability is given under the following conditions:

1. When a socket is listening to incoming connections and a connection is pending, SocketAccept() will complete without blocking.

2. If data is available for reading (includes OOB data if SO_OOBINLINE is enabled), the functions SocketRecv...() are guaranteed not to block.

3. Connection has been closed, reset or terminated. In this case SocketRecv() will not block, but no data will be read.

The parameter <nWriteFD> identifies the sockets to be checked for writability.

1. If a nonblocking socket is connecting, writability means that SocketConnect() successfully completed.

2. If the socket is not in the process of connecting, writability means that the functions SocketSend...() can be called successfully.

The presence of out-of-band data or any exceptional error conditions is checked for the sockets identified by <nExceptFD>. This applies to:

1. SocketConnect() failed.

2. Out-of-band data is available for reading (only if SO_OOBINLINE is disabled).


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.