the following code checks for an open port and the socket seems to be running really slow:
for line in f.readlines():
line = line.rstrip()
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
if sock.connect_ex((ip, port)) == 0:
print(line + " ▲")
text = line + "\n"
else:
print(line + " ▼")
Does anyone have any idea as to why it could be slow?