note 89666 modified in function.socket-select by danbrown
| From: | danbrown@php.net | Date: | Wed, 18 Mar 2009 14:08:08 +0000 |
| Subject: | note 89666 modified in function.socket-select by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152096@lists.php.net to get a copy of this message | ||
Just noticed that you have to loop socket_select () when using UDP to get all queued packets:
<?php
while (socket_select ($aRead, $aWrite, $aExcept, 1) > 0) {
foreach ($aReadUdp as $oSocket) {
$this->clientReadUdp ($oSocket);
}
}
?>
That's important because every call of socket_select () on UDP brings you only one result. But
there could be 10.000 results queued and if your turnarround time is to slow (server busy, other
sleeps etc.), you'll never progress all results in near realtime.
--was--
Just noticed that you have to loop socket_select () when using UDP to get all queued packets:
while (socket_select ($aRead, $aWrite, $aExcept, 1) > 0) {
foreach ($aReadUdp as $oSocket) {
$this->clientReadUdp ($oSocket);
}
}
That's important because every call of socket_select () on UDP brings you only one result. But
there could be 10.000 results queued and if your turnarround time is to slow (server busy, other
sleeps etc.), you'll never progress all results in near realtime.
http://php.net/manual/en/function.socket-select.php