public function recv($timeout = null)
{
// do we need to set a default timeout?
if ($timeout === null) {
$timeout = self::$defaultTimeout;
}
// what are we doing?
if ($timeout == -1) {
$log = usingLog()->startAction("recv() from ZMQ socket; no timeout");
$this->args[0]->setSockOpt(ZMQ::SOCKOPT_RCVTIMEO, -1);
} else {
$log = usingLog()->startAction("recv() from ZMQ socket; timeout is {$timeout} seconds");
$this->args[0]->setSockOpt(ZMQ::SOCKOPT_RCVTIMEO, $timeout * 1000);
}
// do it
$return = $this->args[0]->recv();
// all done
$log->endAction();
return $return;
}