a php server extension
a tiny swoole
<?php
$serv = new TinySwoole\Server('127.0.0.1', 9501, TSWOOLE_TCP);
$serv->start();
$serv->set([
'reactor_num' => 2,
]);
<?php
function onStart()
{
print_r("server is running..." . PHP_EOL);
}
$serv = new TinySwoole\Server('127.0.0.1', 9501, TSWOOLE_TCP);
$serv->on("Start", "onStart");
$serv->start();
<?php
function onConnect($fd)
{
print_r("client[{$fd}] is connected" . PHP_EOL);
}
$serv = new TinySwoole\Server('127.0.0.1', 9501, TSWOOLE_TCP);
$serv->on("Connect", "onConnect");
$serv->start();
<?php
function onReceive($serv, $fd, $data)
{
print_r("receive data from client[{$fd}]: {$data}");
}
$serv = new TinySwoole\Server('127.0.0.1', 9501, TSWOOLE_TCP);
$serv->on("Receive", "onReceive");
$serv->start();
$serv->send($fd, "hello world");
git clone [email protected]:huanghantao/tinyswoole.git && \
cd tinyswoole && \
phpize && \
./configure && \
make && make install
QQ group:942858122