[zeromq-dev] ZMQ::SocketError: Operation cannot be accomplished in current state

Pieter Hintjens ph at imatix.com
Mon Apr 11 10:25:38 CEST 2011


On Mon, Apr 11, 2011 at 8:51 AM, Sean Grove <sean at bushi.do> wrote:

> I'm using ZeroMQ 2.0.11, and the ruby ffi-rzmq (0.7.2) bindings, and I seem
> to run into this. The code in question is a REQ/REP pair running in separate
> processes, and everything works fine the first time through. The second
> time, I get the above error.
> I'd love to better understand what state the socket is in that it's dying
> here - how can I go about fixing this?

If the second time through your REQ socket complains, it's because it
didn't get a reply to its request, and you're trying to send a second
request.

Usually you can make this work by sticking to a synchronous
request-reply dialog. If you really want an asynchronous dialog,
switch to a dealer (xreq) socket. If you want to use a synchronous
request-reply dialog but be able to resend a request, use the Lazy
Pirate pattern from Ch4 of the Guide, i.e. close the socket, reopen,
send again.

-Pieter



More information about the zeromq-dev mailing list