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

34
vendor/swoole/examples/client/get_socket.php vendored Executable file
View File

@ -0,0 +1,34 @@
<?php
function getClient()
{
$client = new swoole_client(SWOOLE_SOCK_TCP);
if (!$client->connect('127.0.0.1', 9501, -1))
{
exit("connect failed. Error: {$client->errCode}\n");
}
$res = $client->getSocket();
return $client;
}
$client = getClient();
$count = 0;
//$client->set(array('open_eof_check' => true, 'package_eof' => "\r\n\r\n"));
//$client = new swoole_client(SWOOLE_SOCK_UNIX_DGRAM, SWOOLE_SOCK_SYNC); //同步阻塞
//if (!$client->connect(dirname(__DIR__).'/server/svr.sock', 0, -1, 1))
var_dump($client->getsockname());
$client->send("hello world\r\n\r\n");
//for($i=0; $i < 3; $i ++)
{
echo $client->recv();
sleep(1);
}
$client->close();