lib/Doctrine/CouchDB/HTTP/SocketClient.php
public function getConnection(
        $method,
        $path,
        $data = null,
        array $headers = []
    ) {
        $fullPath = $path;
        if ($this->options['path']) {
            $fullPath = '/'.$this->options['path'].$path;
        }

        $this->checkConnection();
        $stringHeader = $this->buildRequest($method, $fullPath, $data, $headers);
        // Send the build request to the server
        if (fwrite($this->connection, $stringHeader) === false) {
            // Reestablish which seems to have been aborted
            //
            // The recursion in this method might be problematic if the
            // connection establishing mechanism does not correctly throw an
            // exception on failure.
            $this->connection = null;

            return $this->getConnection($method, $path, $data, $headers);
        }

        return $this->connection;
    }
public function getConnection(
        $method,
        $path,
        $data = null,
        array $headers = []
    ) {
        $fullPath = $path;
        if ($this->options['path']) {
            $fullPath = '/'.$this->options['path'].$path;
        }

        $this->checkConnection();
        $stringHeader = $this->buildRequest($method, $fullPath, $data, $headers);
        // Send the build request to the server
        if (fwrite($this->connection, $stringHeader) === false) {
            // Reestablish which seems to have been aborted
            //
            // The recursion in this method might be problematic if the
            // connection establishing mechanism does not correctly throw an
            // exception on failure.
            $this->connection = null;

            return $this->getConnection($method, $path, $data, $headers);
        }

        return $this->connection;
    }
public function getConnection ( $ method , $ path , $ data = null , array $ headers = [ ] ) { $ fullPath = $ path ; if ( $ this -> options [ 'path' ] ) { $ fullPath = '/' . $ this -> options [ 'path' ] . $ path ; } $ this -> checkConnection ( ) ; $ stringHeader = $ this -> buildRequest ( $ method , $ fullPath , $ data , $ headers ) ; // Send the build request to the server if ( fwrite ( $ this -> connection , $ stringHeader ) === false ) { // Reestablish which seems to have been aborted // // The recursion in this method might be problematic if the // connection establishing mechanism does not correctly throw an // exception on failure. $ this -> connection = null ; return $ this -> getConnection ( $ method , $ path , $ data , $ headers ) ; } return $ this -> connection ; }
Return the socket after setting up the connection to server and writing
the headers. The returned resource can later be used to read and
write data in chunks. These should be done without much delay as the
connection might get closed.

@throws HTTPException

@return resource
Return the socket after setting up the connection to server and writing the headers . The returned resource can later be used to read and write data in chunks . These should be done without much delay as the connection might get closed .