コード例 #1
0
 function read()
 {
     if (!$this->connected) {
         $this->connect();
     } else {
         $result = socket_read($this->socket, $this->read_buffer->space_remaining());
         if ($result === FALSE) {
             throw new SocketException("Error reading from {$this->name} ({$this->address}:{$this->port})", $this->socket);
         } elseif ($result === '') {
             $this->log("marking as disconnected" . Socket::str_error($this->socket) . "\n");
             $this->disconnect();
         } else {
             $this->read_buffer->append($result);
             //        $this->log("Read:\n" . hex_pretty_print($result) . "\n");
         }
     }
 }