stream_socket_pair.phpt 437 B

12345678910111213141516171819
  1. --TEST--
  2. stream_socket_pair()
  3. --FILE--
  4. <?php
  5. $domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX);
  6. $sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0);
  7. var_dump($sockets);
  8. fwrite($sockets[0], b"foo");
  9. var_dump(fread($sockets[1], strlen(b"foo")));
  10. fclose($sockets[0]);
  11. ?>
  12. --EXPECTF--
  13. array(2) {
  14. [0]=>
  15. resource(%d) of type (stream)
  16. [1]=>
  17. resource(%d) of type (stream)
  18. }
  19. string(3) "foo"