php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30926 change the return value of socket_select() !
Submitted: 2004-11-29 02:59 UTC Modified: 2010-11-18 23:50 UTC
From: igor at gameplasma dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 - 1 = ?
Subscribe to this entry?

 
 [2004-11-29 02:59 UTC] igor at gameplasma dot com
Description:
------------
Hi, I've noticed that when using socket_select() it will return an integer greater than 0 when something has happened to one of the sockets we are watching.

Then, if we are watching, say 100 sockets, we must go through each one of them until we find the one we can now access.

Instead, how about returning an array with 2 elements?

$array[0] will be a pointer to the socket that was changed
$array[1] will be "r" or "w" or "e" to indicate whether it's now avaible for read, write, or there is an error :).

Thanks!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-18 23:50 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: Sockets related
 [2010-11-18 23:50 UTC] jani@php.net
From http://www.php.net/socket_select

"No socket resource must be added to any set if you do not intend to check its result after the socket_select() call, and respond appropriately. After socket_select() returns, all socket resources in all arrays must be checked. Any socket resource that is available for writing must be written to, and any socket resource available for reading must be read from."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 05:01:30 2024 UTC