[zeromq-dev] Deadlock between REQ/REP sockets?
Martin Sustrik
sustrik at 250bpm.com
Fri May 28 12:35:19 CEST 2010
Dana,
> Right, the server starts with recv() and follows up with a send() before
> starting at the top of the loop again. The client starts with send() and
> always follows with a recv(). The P2P socket was in the design made by a
> co-worker. Some clients need to send messages and don't expect a reply.
> I suppose we could change this to a PUB/SUB pattern, but I think there
> may have been other reasons for the P2P that I can't remember at the moment.
Creating a socket per client seems plain wrong. What 0MQ does for you is
managing many peers without you having to care about it.
If what you want is client that sends requests to the server and gets
replies from it as well as listen to messages published by server,
simply create a REP and PUB sockets in server and REQ and SUB socket in
the client.
That way you can forget about connection management completely. 0MQ will
do that for you for free.
Martin
More information about the zeromq-dev
mailing list