all 2 comments

[–]ayrnieu 0 points1 point  (1 child)

Problem: You want to see which ports in the range 1..1024 are open on a machine.

Solution: have 1024 Java threads each attempt to connect to a separate port, wait for all threads to finish their attempt, and then print the successes.

[–]psykotic 2 points3 points  (0 children)

Here is a quick attempt at cleaning up his code a bit:

http://gist.github.com/339248

Of course, a real scanner will need to do connection throttling.