kumistatus/porttools/__init__.py

11 lines
195 B
Python
Raw Normal View History

2016-03-30 16:15:30 +00:00
import socket
def isPortOpen(host, port):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(1)
sock.connect((host, port))
except:
return False
return True