This is what I am currently using in my req-rep application. Its generalized so that a number of different processes can use the same code:

http://pastebin.com/HSYqsxRn

If I am exiting normally I just call clean_up with an exit level of 0 and no error message

<-Douglas Petican->

On 2016-06-11 7:14 PM, Mazzaroth M. wrote:
I'm making a pyzmq app which uses the publisher-subscribe pattern and when I setup a zeromq device in a controller class, I'm not able to cleanup the port and on next run I get the `Address already in use` error on startup(and I will need to reboot to release the port).

I believe that I'm not able to cleanup the device when I quit the controller. It may be quite simple: https://bitbucket.org/sidha/twitpub/commits/c9d047f5eca4d03fe30f8d844bd367c0894fa47d#chg-twitpub/controller.py

How do I cleanup the Device object on a keyboard interrupt? I initiate the app from a run script: https://bitbucket.org/sidha/twitpub/src/c9d047f5eca4d03fe30f8d844bd367c0894fa47d/twitpub/run?fileviewer=file-view-default

I was thinking of overriding __del__ but it never gets called on ctrl-c

regards,
Michael


_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to