Exemple #1
0
def checkSmtp():
    """
	Make a connection socket test into STMP server.
    Return status code of SocketType.connect_ex().
	"""
    try : 
        S = SocketType()
        S.settimeout(2)
        smtpStatus = S.connect_ex( ( settings.SNAFU['smtp-server'],settings.SNAFU['smtp-port']) )
        S.close()
    except (error,gaierror), e : smtpStatus = e
    return smtpStatus
Exemple #2
0
	def is_on(self):
		"""
		Make a connection socket test.
		"""
		from urlparse import urlsplit

		S = SocketType()
		S.settimeout(2)
		errno = S.connect_ex((urlsplit(settings.SNAFU['glpi-url']).netloc, 80))
		S.close()

		if errno < 0 :
			return False
		return True