public function sendCommand($command, $port = null, &$error = null)
    {
        $port or $port = $this->choosePort();
        $sockFile = $this->runDir . "command-{$port}.sock";
        if (!$socket = @stream_socket_client('unix://' . $sockFile, $errNo, $errStr, 5)) {
            $error = ['err' => $errNo, 'message' => $errStr];
            return "$errStr ($errNo)";
        }
        $error = false;
        fwrite($socket, $command, strlen($command));
        $response = fread($socket, 8192);
        fclose($socket);
        return $response;
    }