Advertisement
kiler129

Untitled

Mar 27th, 2016
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2. function _gs($s){echo "GOT SIG #$s\n";};
  3. pcntl_signal(SIGUSR1, '_gs');
  4.  
  5. var_dump(getmypid());
  6. $s = stream_socket_server('tcp://0.0.0.0:9999');
  7.  
  8. $rBase = [$s, fopen('php://stdin', 'r')];
  9. foreach($rBase as $set){
  10.  stream_set_blocking($set, 0);
  11. }
  12. while(true) {
  13.  $r = $rBase;
  14.  $w = [];
  15.  $e = $rBase;
  16.  
  17.  $ss = stream_select($r, $w, $e, null);
  18.  var_dump($ss, $r, $w, $e);
  19.  
  20.  echo "\n-------------------------------------\n";
  21.  sleep(1);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement