ChmpxServer::reply
Replies a message
Description
public function reply(string $strbinary):bool {}
Replies a message.
Parameters
- strbinary
- Specifies a message to be replied
Return Values
Returns true on success or false on failure.
Examples
ChmpxServer:
php -r '
> $chmpx = new Chmpx();
> $chmpx->createServer("./tests/server.yaml", true);
> $svrobj = $chmpx->getChmpxServer();
> $rcvdata = "";
> $svrobj->receive($rcvdata, 10 * 1000, true);
> var_dump($svrobj->reply($rcvdata));
'
ChmpxSlave:
php -r '
> $chmpx = new Chmpx();
> $chmpx->createSlave("./tests/slave.yaml", true);
> $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:
ChmpxServer:
bool(true)
ChmpxSlave:
rcvdata:hello, world!
See Also
- Chmpx::createServer - Creates a ChmpxServer instance
- Chmpx::getChmpxServer - Gets a ChmpxServer instance
- ChmpxServer::receive - Gets a message