Is there a good way, in, say, a LineReceiver based server, to implement a bit of code in lineReceived() that, if you receive a line like, let's say, 'shutdown' from a client, you can call:
1) self.transport.write('goodbye\n') # send a goodbye message to the client And then call 2) self.transport.close() # close the client's socket And then 3) reactor.stop() # terminate the server The problem I'm finding is that since I believe self.transport.write() enqueues the writing for later, and self.transport.close() enqueues the closing for later, both to be picked up by the reactor soon after my lineReceived() returns, so then if you stop the reactor in #3, it won't be available anymore to carry out any enqueued tasks for you. At least I think that's what's happening in my code. Is there any good workarounds? E.g., is reactor.callLater(5, reactor.stop) too much of a hack? _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python