How to quit an asyncore dispatcher from a handler?
问题 I couldn't find this in the docs, but how am I meant to break out of the asyncore.loop() without using signals? 回答1: That was quick to work out after looking at the source code. Thanks to the docs for linking directly to the source! There is an ExitNow exception you can simply raise from the app, which exits the loop. Using the EchoHandler example from the docs, I've modified it to quit immediately when receiving data. class EchoHandler(asyncore.dispatcher_with_send): def handle_read(self):