I wonder how to make a status checker, checking about 500 addresses in a few minutes?
(it’ll check a certain port if its listening).
But I care about the performance… so I don’t know if it can be done with PHP. Waiting for your suggestions guys.
Also please give me some examples, if you think that the best way for this thing will be PHP or C#.
Ofc. I meant the TCP connection but not http, since I need to check open port for example: 11740
Edit:
Added third bounty for this question! Please post some better answer than those already posted.
The best way to this would be nmap, as mentioned in other answers.
You’d want to run it like this (
-PNis don’t ping,-sPmeans to skip the port scan and just check if the host is up,-PS80means to check port 80,-nis not to do reverse DNS lookup,-oG -is to output in machine readable format, and the other arguments are IP addresses or hostnames):And it would look like this:
You could run and parse this from PHP with no trouble. I’m not very experienced in PHP, and haven’t tested this, but here’s some example code:
Mind you, writing PHP code or C# code or whatever that does this isn’t a big deal, it’s just that
nmapis very very good at what it does, and extremely versatile, that writing code that does this is reinventing the wheel. If you do decide to go that route, make sure you make your code asynchronous, otherwise one slow server would slow down your entire sweep.