Hello , Thanks a lot for the great reply appreciated a lot.
At present i am terminating the application by simply closing the python interpreter with close button at the control panel. :-) It will be more mature once i am clear with more ZMQ stuffs. I have two problems actually, first is getting the signal Justin mentioned in his previous mail. 1 HUP (hang up) 2 INT (interrupt) 3 QUIT (quit) 6 ABRT (abort) 9 KILL (non-catchable, non-ignorable kill) 14 ALRM (alarm clock) 15 TERM (software termination signal) Once this is solved i will attempt for the other one. Can you help me in this. How to catch the Term(software termination signal) Thanks again Date: Fri, 16 Mar 2012 07:35:10 -0500 From: cornto...@cct.lsu.edu To: zeromq-dev@lists.zeromq.org Subject: Re: [zeromq-dev] FW: Help With Regard To the ZMQ Forwarder Ronald, My understanding is that those signals are defined by the operating system and are interrupts that occur when certain events happen. So for instance, if your program was in an infinite loop and the user pressed CTRL-C, an interrupt signal, SIGINT, would be generated. The signal module defines an API to handle those signals for various operating systems. What you have to do is define a function to handle a particular signal, see this for more information: http://stackoverflow.com/questions/1112343/how-do-i-capture-sigint-in-python The example below includes a SIGINT interrupt handler. import signalimport sysimport zmq incoming = Noneoutgoing = Nonecontext = None def startForwarder(): context = zmq.Context(1) incoming = context.socket(zmq.SUB) try: incoming.connect("tcp://127.0.0.1:5551"); incoming.setsockopt(zmq.SUBSCRIBE, "") except: print("incoming socket is already open") try: outgoing = context.socket(zmq.PUB) outgoing.bind('tcp://127.0.0.1:5562') except: print("outgoing socket is also open close it") zmq.device(zmq.FORWARDER, incoming, outgoing) def signal_handler(signal, frame): global incoming, outgoing, context incoming.close() outgoing.close() context.term() sys.exit(0) signal.signal(signal.SIGINT, signal_handler) startForwarder() Ronald, also when you say it runs the first time, but you get a ZMQError subsequently, how are you terminating your program? Your answer to this question will let you know which signals you need to define handlers for. -- Cornelius Toole Sent with Sparrow -- Cornelius Toole Sent with Sparrow On Thursday, March 15, 2012 at 11:36 PM, Symbian Projects wrote: Hello Justin Can you tell me where these signals are defined, like in PyZMQ or somewhere else i am not able to use them. :-( > From: jhc...@gmail.com > Date: Thu, 15 Mar 2012 14:59:31 +0000 > To: zeromq-dev@lists.zeromq.org > Subject: Re: [zeromq-dev] FW: Help With Regard To the ZMQ Forwarder > > At the bottom of the Python docs for signal module: > > http://docs.python.org/library/signal.html > > On Thu, Mar 15, 2012 at 1:46 PM, Symbian Projects <proj_symb...@live.com> > wrote: > > Oh are there any documentation about this signal handlers, from them they > > seems to be very useful. > > > > Or can you help me with a small snippet to use any one of them?? > > -- > Justin Cook > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________zeromq-dev mailing listzeromq-dev@lists.zeromq.orghttp://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