[Twisted-Python] protocol.Protocol and transport.write

Christopher Armstrong radeex at gmail.com
Tue Jul 19 08:13:30 EDT 2005


On 7/19/05, Michele Petrazzo <michele.petrazzo at unipex.it> wrote:
> My question is: when I call reactor.stop, it close all, also if there
> are some communication in progress? Is there another method to close the
> communication (and in my case the program) when I'm sure that all the
> works are ended?
> 
> class ConneExist(protocol.Protocol):
>    def connectionMade(self):
...
>   # reactor.stop() <- here is a problem
>   reactor.callLater(1, reactor.stop)


Just call reactor.stop() from connectionLost instead of connectionMade.


-- 
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |  
w----v----w-+




More information about the Twisted-Python mailing list