def run(self):
# loop over the "in" queue and get a new port and scan it
socket.setdefaulttimeout(TIMEOUT)
while 1:
host, port = self.inq.get()
sd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# connect to the given host:port
sd.connect((host, port))
except socket.error:
# set the CLOSED flag
self.outq.put((host, port, 'CLOSED'))
else:
# set the OPEN flag
self.outq.put((host, port, 'OPEN'))
sd.close()
评论列表
文章目录