php Function Stream_Select
A php function that is used for monitoring streams, this is the equivalent of socket_select() in other languages. It watches a list of streams and waits for any of them to change status. When a stream becomes ready it may be passed to calls like fgets() or fread(). If the mode parameter is set to 0 then the given stream will be switched to non-blocking mode. This will mean that calls to fgets() or fread() will return right away. If the mode parameter is set to 1 then the given stream will be switched to blocking mode. This will mean that calls to
The read array is watched to see if any characters become available for reading. The write array is watched to see if there's any space left in the socket's write buffer for new data (in particular, to tell if a call to fwrite() will not block). The except array is watched for high priority exceptional ("out-of-band") data arriving.
Each of the arrays read, write and except are modified after the stream_select() function returns. tv_sec and tv_usec together form the timeout parameter that determines how long to wait for any of the stream resources to change status. If they do not change status in this timeout then false is returned and a warning raised.
A good use for this function would be if you need to interoperate with other programs that provide their status information on auxiliary file descriptors (such as PGP, GPG and OpenSSL). It is also useful if you want to pass passphrases in an asynchronous manner when using ncurses.