Functions and Directives

Function SocketSelect() Professional

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

Syntax
SocketSelect( [<nReadFD>]  , ;
              [<nWriteFD>] , ;
              [<nExceptFD>], ;
              [<aTimeOut>] , ;
              [@<nError>]    ) --> nNumberOfSockets
Parameters
<nReadFD>
Numeric handle of a descriptor set of sockets to be checked for readability.
<nWriteFD>
Numeric handle of a descriptor set of sockets to be checked for writability.
<nExceptFD>
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 1/1000 seconds.
<nError>
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.
Return

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.

Description

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:

Connection has been closed, reset or terminated.
If a socket is connecting (nonblocking), writability means that SocketConnect() successfully completed.
If the socket is not in the process of connecting, writability means that the functions SocketSend...() will complete without blocking.
SocketConnect() failed.
Out-of-band data is available for reading (only if SO_OOBINLINE is disabled).

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

Double-click on the mdidemo.upsize file in the Project Manager of the Xbase++ Workbench.

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

Double-click on the mdidemo.upsize file in the Project Manager of the Xbase++ Workbench.
Feedback

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.