1<?php 2$tcp = uv_tcp_init(); 3 4uv_tcp_bind6($tcp, uv_ip6_addr('::1',9999)); 5 6uv_listen($tcp,100, function($server){ 7 $client = uv_tcp_init(); 8 uv_accept($server, $client); 9 var_dump(uv_tcp_getsockname($server)); 10 11 uv_read_start($client, function($socket, $nread, $buffer) use ($server){ 12 var_dump($buffer); 13 uv_close($socket); 14 uv_close($server); 15 }); 16}); 17 18$c = uv_tcp_init(); 19uv_tcp_connect($c, uv_ip6_addr('::1',9999), function($client, $stat){ 20 if ($stat == 0) { 21 uv_write($client,"Hello",function($socket, $stat){ 22 uv_close($socket); 23 }); 24 } 25}); 26 27uv_run(); 28