1--TEST-- 2Streams Based IPv4 UDP Loopback test 3--FILE-- 4<?php 5 /* Setup socket server */ 6 $server = stream_socket_server('udp://127.0.0.1:31338', $errno, $errstr, STREAM_SERVER_BIND); 7 if (!$server) { 8 die('Unable to create AF_INET socket [server]'); 9 } 10 11 /* Connect to it */ 12 $client = stream_socket_client('udp://127.0.0.1:31338'); 13 if (!$client) { 14 die('Unable to create AF_INET socket [client]'); 15 } 16 17 fwrite($client, "ABCdef123\n"); 18 19 $data = fread($server, 10); 20 var_dump($data); 21 22 fclose($client); 23 fclose($server); 24?> 25--EXPECT-- 26string(10) "ABCdef123 27" 28