A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/341828.html below:

threads/sockets quick question.

threads/sockets quick question.ed edhotchkiss at gmail.com
Mon Sep 19 03:56:17 EDT 2005
import socket
import threading
import traceback


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


def scan(ip, thebegin, theend):
        global ip
        global thebegin
        global theend
        port_counter = 0
 for port_counter in range(thebegin, theend):
            scanThread().start()
# end function -------------------
scan("localhost", 0, 10000)


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4