<div>Let's say that I avoid the complexities of using classes, and that I avoid using anything to count the threads...</div>
<div> </div>
<div>import socket<br>import threading</div>
<div><br>def scan(ip, port):<br> try:<br> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br> s.connect((ip, port))<br> s.close()<br> print '%s | %d OPEN \nscanned: %d' % (ip, port, port)
<br> except:<br> print '%s | %d CLOSED \nscanned: %d' % (ip, port, port)</div>
<div>ip = 'localhost'<br>for port in range(1, 1024):<br> thread.start_new_thread(scan, (ip, port,))</div>
<div> </div>
<div> </div>
<div>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...</div>
<div>thanks again.</div>
<div> </div>
<div>-edward</div>