threads/sockets quick question.

Ed Hotchkiss edhotchkiss at gmail.com
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):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port))
s.close()
print '%s | %d OPEN \nscanned: %d' % (ip, port, port)
except:
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.
 -edward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050919/94ee8d79/attachment.html>


More information about the Python-list mailing list