[zeromq-dev] Question to ZMQ_LINGER

Zoufal Andreas Andreas.Zoufal at ait.ac.at
Fri Feb 25 13:47:18 CET 2011


Thanks Martin, I see. Maybe it would be option for future versions? It would make it much easier to write clean test code without aproox. waiting. 
Kind regards, Andi
________________________________________
From: zeromq-dev-bounces at lists.zeromq.org [zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Martin Sustrik [sustrik at 250bpm.com]
Sent: Friday, February 25, 2011 12:55 PM
To: ZeroMQ development list
Cc: Zoufal Andreas
Subject: Re: [zeromq-dev] Question to ZMQ_LINGER

Hi Andreas,

> thanks for the new version with a lot of good new features. But I
> have a question about ZMQ_LINGER. My test code breaks now at many
> points or hang. Of course, I have to use ZMQ_LINGER now to avoid
> zmq_term() to hang indefinitely for some tests, I read this in the
> manual. But now I run into another problem. I repeat the sequence
> (socket with linger option, bind, close) frequently, without send or
> receive action. Now I get errors "Addreass already in use", I guess
> because zmq_close() is not blocking for the lingering.
>
> Is there a way to synchronize (block) zmq_close() for thde pending
> linger?

zmq_close() is async, so only way to make sure that associated resources
are closed is to close the whole context using zmq_term(). That
operation blocks until all the sockets are fully closed.

Martin
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev



More information about the zeromq-dev mailing list