[zeromq-dev] ROUTER Broker and DEALER clienter , DEALER can't send msg while waiting ?

Mo Jia life.130815 at gmail.com
Fri Feb 28 20:01:11 CET 2014


Dear all,

      I have this need : there is one router broker socket only handle
clients call.
and the router broker socket only handle worker(in server) . After worker
get ready
,when a client send request , the client broker receive and use the worker
broker to connect with worker socket .
     Using REQ  socket in client is fine .
     Here is the problem ,  client using req to client broker  , it just
can send receive and send and recive .  When use ctrl+c to term it ,I want
send a message to tell the client broker , but it can't
     error msg like : ZMQError: Operation cannot be accomplished in current
state

    So i change client req socket to dealer scoket , when capture ctrl+c
send a message . but the error is
  ZMQError: Interrupted system call

   The client  get msg something like :

        sockets = dict(self.poller.poll(1000*60*6)) # 1 min
        if sockets :
            if sockets.get(self.socket)  == zmq.POLLIN:
                return self.socket.recv()
        else:
            print "error : message timeout "
            return None

   The client broker (router ) send msg  like   :

    send_multipart([client_addr,  resultPack])

    I am not sure , I assume the the client broker can get msgs from
clients , and worker broker can't create much msg [ then use client broker
to send clients],
so the client want to kill it.  When it kill , the client broker
should know there is a client out . we can force to tell the worker broker
to end thisk task get ready for another.
( so I think  the worker should use DEALER socket to receive the  KILL
signal , while it was create data or  wait in sending ? seem  it will be
isomorphic) to my problem ,but i have got to this step)

   In one way , Can i implement it like I just said . If I can , so when
the socket is on receiving date , how it can send anther msg ?
  Or what i understanding something wrong ? And zmq use some more idiom
to meet my needs ?

                                                    Thank you .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140301/afe3796b/attachment.htm>


More information about the zeromq-dev mailing list