[Tutor] 3 questions for my port scanner project

Alan Gauld alan.gauld at freenet.co.uk
Mon Feb 28 01:20:38 CET 2005


> > Use a canvas and redraw a rectangle slightly larger every
> > time through the scanning loop.
>
> Thats think this is the easy part...
> The hard part is to make the bar move "with" the program (so every
> port it finishes the bar will slightly move, which depends on the
> total number of ports to scan...).

But since you know the range of ports you can calculate the total
number. If you keep a count of how many scanned you can work out
the percentage scanned. You then draw a rectangle the same percentage
of the total width. After each port scanned recalculate the
percentage and redraw the rectangle.

Where's the problem? :-)

Alan G.



More information about the Tutor mailing list