ext-uv/examples/udp_bind.php
2012-07-21 15:53:44 +09:00

19 lines
374 B
PHP

<?php
$udp = uv_udp_init();
var_dump($udp);
uv_udp_bind($udp, uv_ip4_addr('0.0.0.0',10000));
uv_udp_recv_start($udp,function($stream, $nread, $buffer){
echo "recv:" . $buffer;
uv_close($stream);
});
$uv = uv_udp_init();
uv_udp_send($uv, "Hello", uv_ip4_addr("0.0.0.0",10000),function($uv, $s){
echo "success" . PHP_EOL;
uv_close($uv);
});
uv_run();