in reply to multithreading solution to the below problem
As its unlikely that you just want to ping the subnet.
I would use nmap for this in a pipe from perl. With the -oX argument for XML output or similar output format to read in.