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