/** * */ public function read() { $result = socket_read($this->socket, 6000); if ($result) { $this->handler->execute($result); } }
/** * */ public function read() { $NULL = null; $num_changed = socket_select($this->read, $NULL, $NULL, 0); if ($num_changed) { if (in_array($this->socket, $this->read)) { $this->client[] = socket_accept($this->socket); } foreach ($this->client as $key => $value) { if (in_array($value, $this->read)) { $result = socket_read($value, 6000); if ($result) { $this->handler->execute($result); } else { socket_shutdown($value); unset($this->client[$key]); } } } } $this->read = $this->client; $this->read[] = $this->socket; }