Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

23
vendor/swoole/examples/udp/async_client.php vendored Executable file
View File

@ -0,0 +1,23 @@
<?php
$client = new swoole_client(SWOOLE_SOCK_UDP, SWOOLE_SOCK_ASYNC); //异步非阻塞
$client->on("connect", function(swoole_client $cli) {
echo "connected\n";
$cli->send("hello world\n");
});
$client->on('close', function($cli){
echo "closed\n";
});
$client->on('error', function($cli){
echo "error\n";
});
$client->on("receive", function(swoole_client $cli, $data){
echo "received: $data\n";
sleep(1);
$cli->send("hello_".rand(1000,9999));
});
$client->connect('127.0.0.1', 9502, 0.5);