On Fri, 2002-03-08 at 10:22, J Smith wrote: > > I don't think that's a hot idea. The return value of select() is an int for > reason and not merely true or false. It's supposed to return the number of > file descriptors that are ready for reading, writing or exceptions.
The correct behavior that is consistent with the API follows(that I am planning): Set retval of socket_select() to be the number of file descriptors available. If error occurs set to false. Using the c-api one commonly writes code like this -------------------------------------------------- Error on an actual error or no sockets available: ret=select(rfds, NULL, NULL, &tv); if (ret < 0) error_func(); Error differently: ret=select(rfds, NULL, NULL, &tv); if (ret == -1) error_sys(); if (ret == 0) error_noavail(); The equiv in php using false: ------------------------------ Error on an actual error or no sockets available: $ret=socket_select($rfds, NULL, NULL, 1); if (ret == 0) error_func(); Error differently: $ret=socket_select($rfds, NULL, NULL, 1); if (ret === FALSE) error_sys(); if (ret === 0) error_noavail(); > According to the man file: > > (Although without the functions equivalent > to the FD_* macros', the extension as a whole is getting pretty far removed > from the standard sockets library as it is.) > > J Yes, the goal is to follow a more php like behavior. Those who follow the C-API will have some slight adjusting to, but the beauty of the high-level language is that we can automate and simplify the functionality. This also makes it easier for people who don't know C to pickup the functionality. -Jason > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jason T. Greene Internet Software Engineer <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> Use PHP: http://www.php.net -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php