Return to stream_copy_to_stream_socket.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams |
1.1 misho 1: --TEST-- 2: stream_copy_to_stream() with socket as $source 3: --SKIPIF-- 4: <?php 5: $sockets = @stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0); 6: if (!$sockets) die("skip stream_socket_pair"); 7: ?> 8: --FILE-- 9: <?php 10: 11: $sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0); 12: $tmp = tmpfile(); 13: 14: fwrite($sockets[0], b"a"); 15: stream_socket_shutdown($sockets[0], STREAM_SHUT_WR); 16: stream_copy_to_stream($sockets[1], $tmp); 17: 18: fseek($tmp, 0, SEEK_SET); 19: var_dump(stream_get_contents($tmp)); 20: 21: stream_copy_to_stream($sockets[1], $tmp); 22: 23: fseek($tmp, 0, SEEK_SET); 24: var_dump(stream_get_contents($tmp)); 25: 26: 27: ?> 28: --EXPECT-- 29: string(1) "a" 30: string(1) "a"