threads/sockets quick question.

Ed Hotchkiss edhotchkiss at
Mon Sep 19 09:51:40 CEST 2005

Well, I fixed those problems, now what I have is this:
but i am getting errors with the global variables or something ... am i 
supposed to use this class and def together differently? I just don't seem 
to understand ... 
import socket
import threading
import traceback

class scanThread(threading.Thread):
def run(self):
ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ss.connect((ip, port_counter))
print "%s | %d OPEN" % (ip, port_counter)
print "scanned: ",port_counter,"\n"
# end class -------------------

def scan(ip, thebegin, theend):
global ip
global thebegin
global theend
port_counter = 0
for port_counter in range(thebegin, theend):
# end function -------------------
scan("localhost", 0, 10000)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list