SlightPHP\SMTP::Connected PHP Method

Connected() public method

Returns true if connected to a server otherwise false
public Connected ( ) : boolean
return boolean
    public function Connected()
    {
        if (!empty($this->smtp_conn)) {
            $sock_status = socket_get_status($this->smtp_conn);
            if ($sock_status["eof"]) {
                // hmm this is an odd situation... the socket is
                // valid but we are not connected anymore
                if ($this->do_debug >= 1) {
                    echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
                }
                $this->Close();
                return false;
            }
            return true;
            // everything looks good
        }
        return false;
    }