2012-05-29 18:51:31 +02:00
|
|
|
<?php
|
|
|
|
$udp = uv_udp_init();
|
|
|
|
var_dump($udp);
|
|
|
|
|
2012-06-02 14:45:43 +02:00
|
|
|
uv_udp_bind($udp, uv_ip4_addr('0.0.0.0',10000));
|
2012-07-01 15:35:22 +02:00
|
|
|
uv_udp_recv_start($udp,function($stream, $nread, $buffer){
|
2012-05-29 18:51:31 +02:00
|
|
|
echo "recv:" . $buffer;
|
|
|
|
|
2012-07-01 15:35:22 +02:00
|
|
|
uv_close($stream);
|
2012-05-29 18:51:31 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
$uv = uv_udp_init();
|
2012-07-01 15:35:22 +02:00
|
|
|
uv_udp_send($uv, "Hello", uv_ip4_addr("0.0.0.0",10000),function($uv, $s){
|
2012-05-29 18:51:31 +02:00
|
|
|
echo "success" . PHP_EOL;
|
|
|
|
uv_close($uv);
|
|
|
|
});
|
|
|
|
|
|
|
|
uv_run();
|