protected function receive()
    {
        try {
            $data = $this->client->recv();

            if ($data === false) {
                $errorCode = $this->client->errCode;

                if ($errorCode == 11) {
                    throw new TransportException('Receive timeout in '.$this->getTimeout().' ms.',
                        TransportException::TIMEOUT);
                }

                throw new TransportException('Receive data failed, cause: '.socket_strerror($errorCode).'.',
                    TransportException::CONNECTION);
            } elseif ($data === '') {
                throw new TransportException('Receive data failed, cause the connection has been closed.',
                    TransportException::CONNECTION);
            }
        } catch (TransportException $e) {
            throw $e;
        } catch (Throwable $e) {
            if ($this->causedByTimeout($e)) {
                throw new TransportException('Receive timeout in '.$this->getTimeout().' ms.',
                    TransportException::TIMEOUT, $e);
            }

            throw new TransportException($e->getMessage(), 0, $e);
        }

        return $data;
    }