1--TEST-- 2socket_import_stream: Basic test 3--SKIPIF-- 4<?php 5if (!extension_loaded('sockets')) { 6 die('SKIP sockets extension not available.'); 7} 8 9--FILE-- 10<?php 11 12$domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX); 13$s = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0); 14 15$s0 = reset($s); 16$s1 = next($s); 17 18$sock = socket_import_stream($s0); 19var_dump($sock); 20socket_write($sock, "test message"); 21socket_close($sock); 22 23var_dump(stream_get_contents($s1)); 24--EXPECTF-- 25resource(%d) of type (Socket) 26string(12) "test message" 27