ChmpxServer::replyKv
Replies a key and a value message
Description
public function replyKv(string $strbinkey, string $strbinval):bool {}
Replies a key and a value message.
Parameters
- strbinkey
- Specifies key data
- strbinval
- Specifies value data
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();
> $key = "";
> $val = "";
> $svrobj->receiveKv($key, $val, 10 * 1000, true);
> var_dump($svrobj->replyKv($key, $val));'
'
ChmpxSlave:
php -r '
> $chmpx = new Chmpx();
> $chmpx->createSlave("./tests/slave.yaml", true);
> echo "isRunning:".$chmpx->isRunning();
> $slaveobj = $chmpx->GetChmpxSlave();
> $key = "hello";
> $val = "world!";
> $slaveobj->sendKv($key, $val, true, false);
> $rkey= "";
> $rval = "";
> sleep(2);
> $slaveobj->receiveKv($rkey, $rval);
> echo "rkey:".$rkey." rval:".$rval;'
'
The above example will output:
ChmpxServer:
bool(true)
ChmpxSlave:
rkey:hello rval:world!
See Also
- Chmpx::createServer - Creates a ChmpxServer instance
- ChmpxServer::receiveKv - Receives a message with a key and a value
- Chmpx::createSlave - Creates a ChmpxSlave instance
- ChmpxSlave::sendKv - Sends a message with a key and a value
- ChmpxSlave::receiveKv - Receives a message witha a key and a value