xref: /php-uv/examples/udp_bind.php (revision 99312394)
1<?php
2$udp = uv_udp_init();
3var_dump($udp);
4
5uv_udp_bind($udp, uv_ip4_addr('0.0.0.0', 10000));
6uv_udp_recv_start($udp,function($stream, $buffer){
7    echo "recv:" .  $buffer;
8
9    uv_close($stream);
10});
11
12$uv = uv_udp_init();
13uv_udp_send($uv, "Hello", uv_ip4_addr("0.0.0.0", 10000), function($uv, $status) {
14    echo "success" . PHP_EOL;
15    uv_close($uv);
16});
17
18uv_run();
19