original_string: public function connect() {
  
          // check if we need to convert host to IP
          if (!preg_match('/([0-9]{1,3}\\.){3,3}[0-9]{1,3}/', $this->host)) {
  
              $ip = gethostbyname($this->host);
  
              if ($this->host == $ip) {
  
                  throw new \Exception("Cannot resolve $this->host");
              } else {
                  $this->host = $ip;
              }
          }
  
          // attempt connection
          $this->socket = fsockopen($this->host, $this->port, $this->errno, $this->errstr, $this->timeout);
  
          if (!$this->socket) {
              throw new \Exception("Cannot connect to " . $this->host . " on port " . $this->port . "\n" . $this->errstr . ": " . $this->errstr);
          }
  
          return true;
      }
code: public function connect() {
  
          // check if we need to convert host to IP
          if (!preg_match('/([0-9]{1,3}\\.){3,3}[0-9]{1,3}/', $this->host)) {
  
              $ip = gethostbyname($this->host);
  
              if ($this->host == $ip) {
  
                  throw new \Exception("Cannot resolve $this->host");
              } else {
                  $this->host = $ip;
              }
          }
  
          // attempt connection
          $this->socket = fsockopen($this->host, $this->port, $this->errno, $this->errstr, $this->timeout);
  
          if (!$this->socket) {
              throw new \Exception("Cannot connect to " . $this->host . " on port " . $this->port . "\n" . $this->errstr . ": " . $this->errstr);
          }
  
          return true;
      }
code_tokens: public function connect ( ) { // check if we need to convert host to IP if ( ! preg_match ( '/([0-9]{1,3}\\.){3,3}[0-9]{1,3}/' , $ this -> host ) ) { $ ip = gethostbyname ( $ this -> host ) ; if ( $ this -> host == $ ip ) { throw new \ Exception ( "Cannot resolve $this->host" ) ; } else { $ this -> host = $ ip ; } } // attempt connection $ this -> socket = fsockopen ( $ this -> host , $ this -> port , $ this -> errno , $ this -> errstr , $ this -> timeout ) ; if ( ! $ this -> socket ) { throw new \ Exception ( "Cannot connect to " . $ this -> host . " on port " . $ this -> port . "\n" . $ this -> errstr . ": " . $ this -> errstr ) ; } return true ; }
docstring: Attempts connection to remote host. Returns TRUE if sucessful.
  
  @return boolean
docstring_tokens: Attempts connection to remote host . Returns TRUE if sucessful .