Re: [Tutor] Help with error handling in a while loop

2005-02-18 Thread Mike Bell
I haven't tried the code, but it looks like you need to increment on connection failures, too. I think it's more pythonic to iterate over a range, as in the following for test_port in range(start_port, end_port) but it would suffice to just move the start_port+=1 outside of the try _

[Tutor] Help with error handling in a while loop

2005-02-18 Thread Mark Kels
Hi all. I'm trying to build a simple port scanner (just to learn sockets). here is the code (doesn't work) : import socket sk=socket.socket(socket.AF_INET, socket.SOCK_STREAM) host=raw_input("Enter name of host to scan: ") start_port=input("Enter the start port: ") end_port=input("Enter the end por