Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected ZMQ::SOCKOPT_LINGER behaviour #191

Open
proArtex opened this issue Aug 24, 2018 · 0 comments
Open

Unexpected ZMQ::SOCKOPT_LINGER behaviour #191

proArtex opened this issue Aug 24, 2018 · 0 comments

Comments

@proArtex
Copy link

proArtex commented Aug 24, 2018

According to zmq doc ZMQ_LINGER: "The value of 0 specifies no linger period. Pending messages shall be discarded immediately when the socket is closed with zmq_close()."

So here is my example:

# fpm-script

$context = new ZMQContext();
$socket = $context->getSocket(ZMQ::SOCKET_PUSH);
$socket->setSockOpt(ZMQ::SOCKOPT_LINGER, 0);
$socket->connect("tcp://127.0.0.1:5555");
$socket->send('test');
# cli script
$context = new \ZMQContext();
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:5555'); 

while (true) {
    var_dump($pull->recv());
}

The magic is random msg delivery (like 1 of 5) while there is not (I guess) zmq_close() call inside fpm-script. And it delivers nothing after cli script rerun that is correct behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant