Surely you only need to know how threads work then and then thread the application so that you have x number of threads scanning x number of ports at anyone time so if some take longer than others...