Created
June 8, 2016 09:53
-
-
Save vdchuyen/fac4e15b83d790e2537f928dc238bbae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import time | |
s = socket.socket() | |
address = 'hostname.com' | |
port = 443 | |
try: | |
s.connect((address, port)) | |
print(time.asctime() + " OK") | |
except Exception as e: | |
print("Oops %s:%d. Can not connect %s" % (address, port, e)) | |
finally: | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment