You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
25
vendor/swoole/examples/ssl/async_client.php
vendored
Executable file
25
vendor/swoole/examples/ssl/async_client.php
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$client = new swoole_client(SWOOLE_SOCK_TCP | SWOOLE_SSL, SWOOLE_SOCK_ASYNC); //异步非阻塞
|
||||
$client->on("connect", function (swoole_client $cli)
|
||||
{
|
||||
$cli->send("Hello World\n");
|
||||
});
|
||||
|
||||
$client->on("receive", function (swoole_client $cli, $data)
|
||||
{
|
||||
echo "Receive: $data";
|
||||
$cli->close();
|
||||
});
|
||||
|
||||
$client->on("error", function (swoole_client $cli)
|
||||
{
|
||||
echo "error\n";
|
||||
});
|
||||
|
||||
$client->on("close", function (swoole_client $cli)
|
||||
{
|
||||
echo "Connection close\n";
|
||||
});
|
||||
|
||||
$client->connect('127.0.0.1', 9501);
|
||||
echo "connect to 127.0.0.1:9501\n";
|
Reference in New Issue
Block a user