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

17
vendor/swoole/examples/server/unix_stream.php vendored Executable file
View File

@ -0,0 +1,17 @@
<?php
$serv = new swoole_server(__DIR__."/svr.sock", 0, SWOOLE_PROCESS, SWOOLE_UNIX_STREAM);
$serv->set(array(
'worker_num' => 1,
));
$serv->on('connect', function ($serv, $fd, $from_id){
echo "[#".posix_getpid()."]\tClient@[$fd:$from_id]: Connect.\n";
});
$serv->on('receive', function (swoole_server $serv, $fd, $from_id, $data) {
echo "[#".posix_getpid()."]\tClient[$fd]: $data\n";
$serv->send($fd, json_encode(array("hello" => '1213', "bat" => "ab")));
//$serv->close($fd);
});
$serv->on('close', function ($serv, $fd, $from_id) {
echo "[#".posix_getpid()."]\tClient@[$fd:$from_id]: Close.\n";
});
$serv->start();