src/Epkm/MessagePackRpc/Back.php
public function clientConnection($host, $port, $call)
    {
        $size = $this->size;
        $send = $this->serializer->serialize($call);
        $sock = $this->connect($host, $port);

        if ($sock === false) {
            throw new NetworkErrorException("Cannot open socket");
        }

        ErrorHandler::start();
        $puts = fwrite($sock, $send);
        $error = ErrorHandler::stop();

        if ($puts === false) {
            throw new NetworkErrorException("Cannot write to socket", 0, $error);
        }

        ErrorHandler::start();
        $read = fread($sock, $size);
        $error = ErrorHandler::stop();

        if ($read === false) {
            throw new NetworkErrorException("Cannot read from socket", 0, $error);
        }

        if (!$this->reuseConnection) {
            ErrorHandler::start();
            fclose($sock);
            ErrorHandler::stop();
        }

        return $read;
    }
public function clientConnection($host, $port, $call)
    {
        $size = $this->size;
        $send = $this->serializer->serialize($call);
        $sock = $this->connect($host, $port);

        if ($sock === false) {
            throw new NetworkErrorException("Cannot open socket");
        }

        ErrorHandler::start();
        $puts = fwrite($sock, $send);
        $error = ErrorHandler::stop();

        if ($puts === false) {
            throw new NetworkErrorException("Cannot write to socket", 0, $error);
        }

        ErrorHandler::start();
        $read = fread($sock, $size);
        $error = ErrorHandler::stop();

        if ($read === false) {
            throw new NetworkErrorException("Cannot read from socket", 0, $error);
        }

        if (!$this->reuseConnection) {
            ErrorHandler::start();
            fclose($sock);
            ErrorHandler::stop();
        }

        return $read;
    }
@param $host
@param $port
@param $call

@return string
@throws Exception\NetworkErrorException