src/Daemon/Service.php
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;
    }
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;
    }
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 ; }
Send command to service command handler

@param string $command
@param integer $port
@param         $error
@return string
Send command to service command handler