How could I most efficiently go through a database of 12,000 IP addresses and ping open a socket with them all? Currently I am working like this:
- Get all the IPs in the list
- For every IP, open up a new thread that opens a socket with the server and receives a packet from it.
- On the new thread, update the information based on weather the IP is online, and what it returns when we open the socket.
My current solution works, it just takes ages to get through the database once. I am trying to find a way to get through the database extremely fast; however, I don't know where to begin. Any help is appreciated, thanks!
EDIT: I am opening a socket and sending a TCP packet, then storing the information.