[Tutor] 3 questions for my port scanner project
mwalsh at groktech.org
Sat Feb 26 16:28:03 CET 2005
Mark Kels wrote:
>2. I got a while loop which does the port scan itself. How can I end
>it while its working ?
previous message with code: *http://tinyurl.com/3lobo*
**I'm not totally sure of this, but you might try adding another
conditional to your while loop that can be toggled by a Scan and Stop
button in your Tkinter app.
ok_to_scan = 1 # or True
while (start_port <= end_port) and ok_to_scan:
# ... do scan ...
then bind a function to a Stop button which toggles 'ok_to_scan' to 0
(or False), also as previously suggested you should close the sockets
that find an open port (sk.close()) inside your while loop.
More information about the Tutor