threads/sockets quick question.

Ed Hotchkiss edhotchkiss at
Mon Sep 19 18:45:32 CEST 2005

Let's say that I avoid the complexities of using classes, and that I avoid 
using anything to count the threads...
 import socket
import threading

def scan(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port))
print '%s | %d OPEN \nscanned: %d' % (ip, port, port)
print '%s | %d CLOSED \nscanned: %d' % (ip, port, port)
ip = 'localhost'
for port in range(1, 1024):
thread.start_new_thread(scan, (ip, port,))
  Why does this produce the errr - can't start new thread? I just scrapped 
the rest of the code before, followed peoples ideas, and removed the 
complexities, I can learn the rest later I guess...
thanks again.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list