예제 #1
0
 protected function _Connect($Port = 0)
 {
     parent::_Connect($Port);
     if (!$this->_IOSock) {
         $this->_IOSock = @stream_socket_client("tcp://" . $this->_HOST . ":" . $this->_IOPort, $errorNumber, $errorString, $this->_TimeOut);
         if (!$this->_IOSock) {
             throw new uRcpIoException(__CLASS__ . "=>Could not open socket. Host: " . $this->_HOST . " Port: " . $this->_PORT . " Error: {$errorString} ({$errorNumber})");
         }
         if ($this->_boUseSsl) {
             stream_set_blocking($this->_IOSock, true);
             stream_context_set_option($this->_IOSock, 'ssl', 'SNI_enabled', true);
             if ($this->_caFile) {
                 stream_context_set_option($this->_IOSock, 'ssl', 'cafile', $this->_caFile);
             }
             stream_context_set_option($this->_IOSock, 'ssl', 'verify_peer', $this->sslVerifyPeer);
             $secure = stream_socket_enable_crypto($this->_IOSock, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
             if (!$secure) {
                 $this->_Disconnect();
                 throw new uRcpIoException(__CLASS__ . "=>Failed to enable SSL.");
             }
             stream_set_blocking($this->_IOSock, false);
         }
     }
 }
예제 #2
0
 protected function _Connect($Port = 0)
 {
     parent::_Connect($Port);
     $this->_IOSock = curl_init();
 }
예제 #3
0
 protected function _Connect($Port = 0)
 {
     parent::_Connect($Port);
     $this->_IOSock = true;
 }