/hphp/test/slow/streams/socket-select-index.php

http://github.com/facebook/hiphop-php · PHP · 17 lines · 13 code · 4 blank · 0 comment · 0 complexity · 29c04d73279a30197b3a59840a7160a0 MD5 · raw file

  1. <?hh
  2. <<__EntryPoint>>
  3. function main_socket_select_index() {
  4. $msg = "Hello";
  5. $len = strlen($msg);
  6. $sockets = varray[];
  7. socket_create_pair(AF_UNIX, SOCK_STREAM, 0, inout $sockets);
  8. socket_write($sockets[0], $msg, $len);
  9. $fdset = darray[ 1 => $sockets[1] ];
  10. $write = $excep = varray[];
  11. socket_select(inout $fdset, inout $write, inout $excep, 0, 100);
  12. print_r($fdset);
  13. }