original_string: protected function _connect(
          $host, $port, $timeout, $secure, $context, $retries = 0
      )
      {
          $conn = '';
          if (!strpos($host, '://')) {
              switch (strval($secure)) {
              case 'ssl':
              case 'sslv2':
              case 'sslv3':
                  $conn = $secure . '://';
                  $this->_secure = true;
                  break;
  
              case 'tlsv1':
                  $conn = 'tls://';
                  $this->_secure = true;
                  break;
  
              case 'tls':
              default:
                  $conn = 'tcp://';
                  break;
              }
          }
          $conn .= $host;
          if ($port) {
              $conn .= ':' . $port;
          }
  
          $this->_stream = @stream_socket_client(
              $conn,
              $error_number,
              $error_string,
              $timeout,
              STREAM_CLIENT_CONNECT,
              stream_context_create($context)
          );
  
          if ($this->_stream === false) {
              /* From stream_socket_client() page: a function return of false,
               * with an error code of 0, indicates a "problem initializing the
               * socket". These kind of issues are seen on the same server
               * (and even the same user account) as sucessful connections, so
               * these are likely transient issues. Retry up to 3 times in these
               * instances. */
              if (!$error_number && ($retries < 3)) {
                  return $this->_connect($host, $port, $timeout, $secure, ++$retries, $context);
              }
  
              $e = new Client\Exception(
                  'Error connecting to server.'
              );
              $e->details = sprintf("[%u] %s", $error_number, $error_string);
              throw $e;
          }
  
          stream_set_timeout($this->_stream, $timeout);
  
          if (function_exists('stream_set_read_buffer')) {
              stream_set_read_buffer($this->_stream, 0);
          }
          stream_set_write_buffer($this->_stream, 0);
  
          $this->_connected = true;
      }
code: protected function _connect(
          $host, $port, $timeout, $secure, $context, $retries = 0
      )
      {
          $conn = '';
          if (!strpos($host, '://')) {
              switch (strval($secure)) {
              case 'ssl':
              case 'sslv2':
              case 'sslv3':
                  $conn = $secure . '://';
                  $this->_secure = true;
                  break;
  
              case 'tlsv1':
                  $conn = 'tls://';
                  $this->_secure = true;
                  break;
  
              case 'tls':
              default:
                  $conn = 'tcp://';
                  break;
              }
          }
          $conn .= $host;
          if ($port) {
              $conn .= ':' . $port;
          }
  
          $this->_stream = @stream_socket_client(
              $conn,
              $error_number,
              $error_string,
              $timeout,
              STREAM_CLIENT_CONNECT,
              stream_context_create($context)
          );
  
          if ($this->_stream === false) {
              /* From stream_socket_client() page: a function return of false,
               * with an error code of 0, indicates a "problem initializing the
               * socket". These kind of issues are seen on the same server
               * (and even the same user account) as sucessful connections, so
               * these are likely transient issues. Retry up to 3 times in these
               * instances. */
              if (!$error_number && ($retries < 3)) {
                  return $this->_connect($host, $port, $timeout, $secure, ++$retries, $context);
              }
  
              $e = new Client\Exception(
                  'Error connecting to server.'
              );
              $e->details = sprintf("[%u] %s", $error_number, $error_string);
              throw $e;
          }
  
          stream_set_timeout($this->_stream, $timeout);
  
          if (function_exists('stream_set_read_buffer')) {
              stream_set_read_buffer($this->_stream, 0);
          }
          stream_set_write_buffer($this->_stream, 0);
  
          $this->_connected = true;
      }
code_tokens: protected function _connect ( $ host , $ port , $ timeout , $ secure , $ context , $ retries = 0 ) { $ conn = '' ; if ( ! strpos ( $ host , '://' ) ) { switch ( strval ( $ secure ) ) { case 'ssl' : case 'sslv2' : case 'sslv3' : $ conn = $ secure . '://' ; $ this -> _secure = true ; break ; case 'tlsv1' : $ conn = 'tls://' ; $ this -> _secure = true ; break ; case 'tls' : default : $ conn = 'tcp://' ; break ; } } $ conn .= $ host ; if ( $ port ) { $ conn .= ':' . $ port ; } $ this -> _stream = @ stream_socket_client ( $ conn , $ error_number , $ error_string , $ timeout , STREAM_CLIENT_CONNECT , stream_context_create ( $ context ) ) ; if ( $ this -> _stream === false ) { /* From stream_socket_client() page: a function return of false,
               * with an error code of 0, indicates a "problem initializing the
               * socket". These kind of issues are seen on the same server
               * (and even the same user account) as sucessful connections, so
               * these are likely transient issues. Retry up to 3 times in these
               * instances. */ if ( ! $ error_number && ( $ retries < 3 ) ) { return $ this -> _connect ( $ host , $ port , $ timeout , $ secure , ++ $ retries , $ context ) ; } $ e = new Client \ Exception ( 'Error connecting to server.' ) ; $ e -> details = sprintf ( "[%u] %s" , $ error_number , $ error_string ) ; throw $ e ; } stream_set_timeout ( $ this -> _stream , $ timeout ) ; if ( function_exists ( 'stream_set_read_buffer' ) ) { stream_set_read_buffer ( $ this -> _stream , 0 ) ; } stream_set_write_buffer ( $ this -> _stream , 0 ) ; $ this -> _connected = true ; }
docstring: Connect to the remote server.
  
  @see __construct()
  
  @throws Horde\Socket\Client\Exception
docstring_tokens: Connect to the remote server .