3

Seems like I have some Coding error here, maybe someone can help me. Example:

    class test {

      public function check() {
        $fp = fsockopen('10.10.5.55','80', $errno, $errstr, 1.5);
      }

    }

    class Main extends Thread {

      public function run() {
        $N = new test();
        $N->check();
      }

    }

    $N = new Main();
    $N->start();

Usually since this is Threaded, I would expect, that the job is done async, but it is not. It waits until the connection gets a response, what did I do wrong?

Thanks.

Ne00n
  • 67
  • 6

2 Answers2

0

Have you tried putting it in the same class, so putting the fsockopen inside the construct function of the class "Main"?

  • That does not fix the issue. Even when I move the function into Main, I still have the issue. Dev told me, its a issue with my Code. – Ne00n Nov 05 '16 at 12:55
0

class test {

  public function check() {
    $fp = fsockopen('10.10.5.55','80', $errno, $errstr, 1.5);
  }

}

class Main extends Thread {

  public function run() {
    $N = new test();
   while(true){
     $N->check();
  }

  }

}

$N = new Main();
$N->start();

This will now run every time parrallel