Aerys\CommandClient::establish PHP Method

establish() private method

private establish ( )
    private function establish()
    {
        $unix = in_array("unix", \stream_get_transports(), true);
        if ($unix) {
            $promise = \Amp\Socket\connect("unix://{$this->path}.sock");
        } else {
            $promise = \Amp\pipe(\Amp\file\get($this->path), 'Amp\\Socket\\connect');
        }
        $promise->when(function ($e, $sock) {
            if ($e) {
                $this->failAll();
                return;
            }
            $this->sock = $sock;
            $this->writeWatcher = \Amp\onWritable($sock, $this->writer);
        });
    }