I have a requirement to test x (10) ports for a specific connection.
Is it cheaper to have one thread test all the ports for this connection or to spawn 5 threads and have them each test 2 ports.
It will probably be faster to have multiple threads. If you use just one thread then it'll have to wait for the timeout for each port that's unavailable. But as Ulf said, it will be more complex as you'll need to collect the results of the (other) checking threads.