In regards to the code posted by vardhan ( at ) rogers ( dot ) com, it appears that on the following line:
if (socket_select($read, $write = NULL, $except = NULL, 0) < 1)
the timeout parameter is accidentally set to 0, rather than NULL. This means that the select call will return immediately rather than blocking indefinitely.
Change the socket_select line to the following for great success:
if (socket_select($read, $write = NULL, $except = NULL, NULL) < 1)