Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ERROR | E_PARSE);
- class worker_tcp extends Thread {
- public function __construct($host, $port){
- $this->host=$host;
- $this->port=$port;
- $this->complete = false;
- //global $cc;
- }
- public function run(){
- global $cc;
- $fp = fsockopen($this->host, $this->port, $errno, $errstr, 1);
- if (!$fp) {
- //echo "$errstr ($errno)\n"; // closed port
- }
- else {
- echo "port $this->port open on $this->host\n";
- $cc += 1;
- }
- fclose($fp);
- $this->complete = true;
- }
- public function status() {
- return $this->complete;
- }
- }
- global $cc;
- $cc = 0;
- $p = new Pool(2048);
- $tasks = array();
- for($k=0;$k<1;$k++){
- for($i=0;$i<256;$i++) {
- $c = "0" + $k;
- $ip = "89.40.$c.$i";
- array_push($tasks, new worker_tcp($ip, 80));
- }
- }
- foreach($tasks as $task){
- $p->submit($task);
- }
- sleep(4);
- print("cc: $cc\n");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement