Awesome. Looks like everything is working. I had always been using ZMQ::MODE_NOBLOCK in my send, but I thought it blocked regardless. I probably was just confused by the fact that it was blocking at exit.
So now I'm setting SOCKOPT_LINGER, SOCKOPT_HWM -- and (as always) ZMQ::MODE_NOBLOCK in my send, and everything looks to behave exactly how I need it, and I can happily use the pattern I believe is correct for my purpose. Thanks! On Fri, Aug 19, 2011 at 10:08 AM, Ian Barber <[email protected]> wrote: > On Fri, Aug 19, 2011 at 5:21 PM, Bernt Habermeier <[email protected]>wrote: > >> To be clear, the option I would want is to be able to set a socket option >> (or something like that) that indicates: >> >> - If we hit HWM condition, drop data >> - If we have data at process exit, drop data. >> >> Alternatively, if I can query the queue length of messages that are unsent >> from the API, instead of blindly adding the event to be sent over the >> socket, I could drop it before it ever hits ZMQ. Does this exist? Of >> course, I'd still have to have the ability to "drain the data" to be sent >> out at process exit -- I don't want the process to hang / wait indefinitely. >> >> >> > I think you have the tools you need in the API - look at the ZMQ_LINGER > sockopt for termination, and for sending data you can either use send with > the flag ZMQ_NOBLOCK to guarantee no blocking, or poll the socket first to > see whether a message would block on send. > > Ian >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
