function handleData() {
        try {
            $this->setErrorHandler();
            
            $data = '';
            $bytes = \socket_recv($this->socket, $data, $this->bufferSize, (\defined('MSG_DONTWAIT') ? \MSG_DONTWAIT : 0));
            
            if($bytes === false) {
                $this->checkSocketErrors();
            }
            
            $this->restoreErrorHandler();
            
            if($bytes > 0) {
                $this->emit('data', array($data));
            }
        } catch (\DomainException $error) {
            $this->restoreErrorHandler();
            
            $this->emit('error', array((new \RuntimeException('Unable to read from socket: '.$error->getMessage(), 0, $error))));
            $this->close();
        }
    }