ChmpxServer::receive ChmpxServer Class ChmpxServer::reply

ChmpxServer::receiveKv

Receives a message with a key and a value

Description

public function receiveKv(&$strbinkey, &$strbinval, int $timeout_ms = RCV_NO_WAIT, bool $no_giveup_rejoin = false): bool {}

Receives a message with a key and a value

Parameters

Return Values

Returns true on success or false on failure.

Examples

php -r '
$chmpx = new Chmpx(); 
$chmpx->createServer("./tests/server.yaml", true);
$svrobj = $chmpx->getChmpxServer();
$key = "";
$val = ""; 
$svrobj->receiveKv($key, $val, 10 * 1000, true); 
echo "key:".$key." val:".$val; 
'
php -r '
> $chmpx = new Chmpx();
> $chmpx->createSlave("./tests/slave.yaml", true);
> $slaveobj = $chmpx->GetChmpxSlave();
> $key = "hello";
> $val = "world!";
> $slaveobj->sendKv($key, $val, true, false);
'

The above example will output:

key:hello val:world!

See Also

ChmpxServer::receive ChmpxServer Class ChmpxServer::reply