thedustbustr at aol.com
Wed Sep 12 03:51:03 CEST 2001
I am writing a very simple portscanner for use on my windows box. It works
well, by calling sock.connect() and if it succedes, tis open, if it falis, the
port is closed.
host=sys.argv #host given through cmd line
host='localhost' #default host
for n in range(30,100): #ports to be scanned
print '%s\topen'%n #open
Problem is: If the port is closed, it takes about 45 seconds for socket.error
to be raised! If the port is open the result is instantanious. Run off of
localhost, it takes about 3 sec to find a closed port and instantly finds an
open port. How can i reduce the socket.error catching delay? I dont want to
use a timeout because of lagged packets mesisng things up (and i dont want to
use threads if i can help it anyway).
More information about the Python-list