Check connection state.
@access public
@return boolean True if connected.
341579
public function connected()
    {
        if (is_resource($this->smtp_conn)) {
            $sock_status = stream_get_meta_data($this->smtp_conn);
            if ($sock_status['eof']) {
                // the socket is valid but we are not connected
                if ($this->do_debug >= 1) {
                    $this->edebug(
                        'SMTP NOTICE: EOF caught while checking if connected'
                    );
                }
                $this->close();
                return false;
            }
            return true; // everything looks good
        }
        return false;
    }
315057
public function connect(): bool
	{
		if ($this->ssl === true)
		{
			$this->connection = fsockopen('ssl://'.$this->host, $this->port);
		}
		else
		{
			$this->connection = fsockopen($this->host, $this->port);
		}

		return $this->connected();
	}
920694
public function ping(): bool
    {
        parent::connect();

        if ($this->_conn instanceof Driver\PingableConnection) {
            return $this->_conn->ping();
        }

        try {
            parent::query($this->getDatabasePlatform()->getDummySelectSQL());

            return true;
        } catch (DBALException $e) {
            return false;
        }
    }
940269
public function connect()
    {
        if ($this->isConnected) {
            return false;
        }

        if (!$this->pdo) {
            $this->beforeConnect && call_user_func($this->beforeConnect, $this);

            $dsn = $this->getDsn();
            $attrs = $this->attrs + array(
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_STRINGIFY_FETCHES => true,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
            );

            try {
                $this->pdo = new PDO($dsn, $this->user, $this->password, $attrs);
            } catch (\PDOException $e) {
                $this->connectFails && call_user_func($this->connectFails, $this, $e);
                throw $e;
            }

            $this->afterConnect && call_user_func($this->afterConnect, $this, $this->pdo);
        }

        $this->isConnected = true;

        return true;
    }
723610
public function isConnected()
    {
        $result = false;
        if($entity = $this->getIterator()->current()) {
            $result = $entity->isConnected();
        }

        return $result;
    }
662455
public static function is_active() {
	if (session_status() != PHP_SESSION_ACTIVE) {
		return false;
	}
	if (empty($_SESSION['_session_type']) || empty($_SESSION['_session_last_active'])) {
		return false;
	}
	
	return true;
}
745835
public function isConnectionClose()
    {
        $connection = $this->getHeader('connection');

        if ($this->protocolVersion === '1.1') {
            return ($connection[0] === 'C' || $connection[0] === 'c');
        } else {
            return ($connection[0] !== 'K' && $connection[0] !== 'k');
        }
    }
1233816
public function isSslConnection()
	{
		$serverSSLVar = $this->input->server->getString('HTTPS', '');

		if (!empty($serverSSLVar) && strtolower($serverSSLVar) !== 'off')
		{
			return true;
		}

		$serverForwarderProtoVar = $this->input->server->getString('HTTP_X_FORWARDED_PROTO', '');

		return !empty($serverForwarderProtoVar) && strtolower($serverForwarderProtoVar) === 'https';
	}
1014551
public function isLoggedIn()
    {
        //If you aren't connected you can't be logged in! ($this->isConnected())
        //We are connected - but are we logged in? (the rest)
        return $this->isConnected() && !empty($this->loginStatus) && $this->loginStatus === Constants::CONNECTED_STATUS;
    }
843699
public function Connected() {
    if(!empty($this->smtp_conn)) {
      $sock_status = socket_get_status($this->smtp_conn);
      if($sock_status["eof"]) {
        // the socket is valid but we are not connected
        if($this->do_debug >= 1) {
            $this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected");
        }
        $this->Close();
        return false;
      }
      return true; // everything looks good
    }
    return false;
  }
1231831
public function hasDataToRead()
    {
        if (!$this->isConnected()) {
            throw new ConnectionException('Not connected to any server.', $this->activeHost);
        }

        $isDataInBuffer = $this->connectionHasDataToRead($this->readTimeout[0], $this->readTimeout[1]);
        if (!$isDataInBuffer) {
            $this->observers->emptyBuffer();
        }
        return $isDataInBuffer;
    }
772904
def is_connected(self):
        """"""
        self._connected = self._connected and self._conn.is_connected()
        return self._connected
1032128
public function reconnect() {
        $this->disconnect();
        $this->connect();
        $stats = $this->stats();
        return $stats === false ? false : true;
    }
877987
public function disconnect()
    {
        if ($this->connected) return false;

        $this->exec('exit;');

        $this->connection = null;
        $this->connected  = false;

        return true;
    }
1185686
def verify_state(self):
        """"""
        if self.state == CONNECTING:
            self.state = OPEN

            self.conn.on_open(self.conn_info)
954368
public function canConnect()
    {
        $data = $this->get(self::CURRENT_USER_ENDPOINT);
        if (strpos($data['code'], '2') === 0) {
            return true;
        }
        return false;
    }
960796
public static function check(): bool
  {
	  return
      isset(self::$user, self::$table, self::$db) &&
      self::is_init() &&
      self::_get_db();
  }