Ask God to help explain the function of Socket_select (), see PHP Manual is generally meant to be blocked, what is the case of blocking, when continue to execute AH, the parameters are as follows
int Socket_select (array & $read, array & $write, array & $except, int $tv _sec [, int $tv _usec = 0]);//sock Et_select () accepts arrays of sockets and waits for them to the change status. Those coming with BSD sockets background//will recognize that those socket resource arrays is in fact the so-called file Descriptor sets. Three independent arrays of//socket Resources is watched.//param/*readthe sockets listed in the read array would be watch Ed to see if characters become available for reading (more precisely, to see if a read would not block-in particular, a s Ocket resource is also ready on end-of-file, in which case a socket_read () would return a zero length string). Writethe Sock ETS listed in the write array would be watched to see if a write would not block.exceptthe sockets listed in the except Arra Y'll be watched for exceptions.tv_secthe tv_sec and tv_usec together form the timeout parameter. The timeout is a upper bound on the amount of time elapsed before Socket_seLect () return. Tv_sec May is zero, causing socket_select () to return immediately. This was useful for polling. If Tv_sec is NULL (no timeout), Socket_select () can block indefinitely.*/
Reply to discussion (solution)
Where do you see the blockage?
Socket_select accepts three socket sets of words to check if the socket in the array is in an operational state (only operational sockets are left on return)
The most used is $read, so take read as an example
Initially, you should have a server-side listener socket in the socket string $read
Whenever the socket is readable, it indicates that a user initiated the connection. At this point you need to create a socket for the connection and add it to the $read array
Of course, not only the server-side listener socket will become readable, the user socket will also become readable, you can read the data sent by the user
Socket_select only returns if the socket group has changed. That is, once you execute the next statement to Socket_select, you must have a socket that you want to manipulate.
Thank you, God, for the general understanding.