SphinxClient::Open PHP Method

Open() public method

public Open ( )
    function Open()
    {
        if ($this->_socket !== false) {
            $this->_error = 'already connected';
            return false;
        }
        if (!($fp = $this->_Connect())) {
            return false;
        }
        // command, command version = 0, body length = 4, body = 1
        $req = pack("nnNN", SEARCHD_COMMAND_PERSIST, 0, 4, 1);
        if (!$this->_Send($fp, $req, 12)) {
            return false;
        }
        $this->_socket = $fp;
        return true;
    }

Usage Example

Esempio n. 1
0
 public function closeConnection()
 {
     if (!$this->isConnected) {
         throw new ESphinxException("Sphinx client is already closed");
     } else {
         $this->sphinxClient->Open();
         $this->isConnected = false;
     }
 }
All Usage Examples Of SphinxClient::Open