1--TEST-- 2stream_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); 7var_dump($sockets); 8fwrite($sockets[0], "foo"); 9var_dump(fread($sockets[1], strlen("foo"))); 10fclose($sockets[0]); 11?> 12--EXPECTF-- 13array(2) { 14 [0]=> 15 resource(%d) of type (stream) 16 [1]=> 17 resource(%d) of type (stream) 18} 19string(3) "foo" 20