I understand that socket_select() does not return until it detects changes the the specified socket.
Is it possible to have it check for changes in two separate sockets at once, and somehow tell which of the two sockets was the one that changed?
If not, is there a way to listen on two different sockets in the same script and handle the incoming data?
Calling socket_select() multiple times in one script?
Moderator: General Moderators
-
kaoskorruption
- Forum Commoner
- Posts: 28
- Joined: Tue Jul 18, 2006 2:09 pm
Re: Calling socket_select() multiple times in one script?
Yes, that's why the parameters are arrays.kaoskorruption wrote:Is it possible to have it check for changes in two separate sockets at once, and somehow tell which of the two sockets was the one that changed?
please read http://de2.php.net/manual/en/function.socket-select.php
-
kaoskorruption
- Forum Commoner
- Posts: 28
- Joined: Tue Jul 18, 2006 2:09 pm
-
kaoskorruption
- Forum Commoner
- Posts: 28
- Joined: Tue Jul 18, 2006 2:09 pm
I've read the article extremely thouroughly. It doesn't say anything about checking a socket for reading for more than one array.
I guess it's possible to to copy two arrays into one array, so that it checks the new array, but theres a problem with that. When socket_select() returns, you won't know which of the arrays changed.
I guess it's possible to to copy two arrays into one array, so that it checks the new array, but theres a problem with that. When socket_select() returns, you won't know which of the arrays changed.
-
kaoskorruption
- Forum Commoner
- Posts: 28
- Joined: Tue Jul 18, 2006 2:09 pm