ChmpxSlave::receiveKv ChmpxSlave Class ChmpxSlave::sendKv

ChmpxSlave::send

メッセージを送信する

説明

public function send(string $strbinary, bool $is_routing = true, bool $is_broadcast = false): int {}

メッセージを送信します。

パラメータ

戻り値

送信メッセージ長

php -r '
> $chmpx = new Chmpx();
> $chmpx->createServer("./tests/server.yaml", true);
> $svrobj = $chmpx->getChmpxServer();
> $rcvdata = "";
> $svrobj->receive($rcvdata, 10 * 1000, true);
> $svrobj->reply($rcvdata);'
'
php -r '
> $chmpx = new Chmpx();
> $chmpx->createSlave("./tests/slave.yaml", true);
> echo "isRunning:".$chmpx->isRunning();
> $slaveobj = $chmpx->getChmpxSlave();
> $snddata = "hello, world!";
> $slaveobj->send($snddata, true, false);
> sleep(2);
> $rcvdata= "";
> $slaveobj->receive($rcvdata);
> echo "rcvdata:".$rcvdata;'
'

The above example will output:

isRunning:1
bool(true)
rcvdata:hello, world!

参考

ChmpxSlave::receiveKv ChmpxSlave Class ChmpxSlave::sendKv