Can any body guide me on this problem. Thanks Ronald
From: proj_symb...@live.com To: zeromq-dev@lists.zeromq.org Date: Wed, 4 Apr 2012 10:59:13 +0200 Subject: [zeromq-dev] Publisher receiving message it publishes Hello Guys, Thanks for your replies that all worked great. :-) I have one more question with some different topic: I have PUB/SUB system with a zmq FORWARDER device, and there all clients have the capability of sending and receiving , so what is happening, that whenever a single client publishes a message all other subscriber get it which is correct, but also my publisher is a subscriber too, so my publisher also gets that message, i want the publisher to ignore that. Can anybody help me how i can proceed with that ?? Regards, Ronald From: dan.fa...@gmail.com Date: Tue, 3 Apr 2012 10:44:17 +0100 To: zeromq-dev@lists.zeromq.org Subject: Re: [zeromq-dev] How to make recv() non blocking I got your way of using NOBLOCK, but can you brief me more about how i can use zmq.poll here using the POLLIN and POLLOUT events. Here's an (edited) highlight from our codebase: control_socket = self.context.socket(zmq.SUB) control_socket.setsockopt(zmq.SUBSCRIBE, '') control_socket.connect(self.control_addr) timer_socket = self.context.socket(zmq.SUB) timer_socket.setsockopt(zmq.SUBSCRIBE, '') timer_socket.connect('inproc://timer') poller = zmq.Poller() poller.register(control_socket, zmq.POLLIN) poller.register(timer_socket, zmq.POLLIN) while not self.stop: socks = dict(poller.poll(500)) if socks.get(control_socket) == zmq.POLLIN: message = control_socket.recv() self.handle_control(message) if socks.get(timer_socket) == zmq.POLLIN: message = timer_socket.recv() self.handle_timer(message) self.logger.debug(u'Heartbeat') control_socket.close() timer_socket.close() Hope that helps. It's very similar to the example in the zguide, to be honest, make sure you have a good read of that. Note that this is only really appropriate if you want to check multiple sockets. If you've just got the one socket, something like this might be more appropriate: while not self.stop: try: raw_message = self.pull_socket.recv(zmq.NOBLOCK) except zmq.ZMQError as e: if e.errno != zmq.EAGAIN: raise time.sleep(.5) self.logger.debug(u'Heartbeat') else: self.sync_handle(raw_message) Cheers,Dan-- Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com _______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev