Ejemplo n.º 1
0
 /**
  * Writes data from {@link writeBuffer} to stream.
  */
 protected function write()
 {
     if (($written = @fwrite($this->getStream(), $this->writeBuffer->read($this->writeBuffer->getLength()))) === false) {
         throw new ClientException("Could not write data to socket.");
     }
     if ($written === 0) {
         throw new ClientException("Broken pipe or closed connection.");
     }
     fflush($this->getStream());
     // flush internal PHP buffers
     $this->writeBuffer->discard($written);
     $this->lastWrite = microtime(true);
 }