python - Twisted : How to print message at the server? -
i beginner using twisted framework.
i developing simple client server program using twisted library in python.
i using code @ server side.
factory = protocol.serverfactory() factory.protocol = echo portno = 8000 reactor.listentcp(portno,factory) reactor.run() i print message @ server side, whenever client closes connection.
any idea how ?
thanks
extend connectionlost method of protocol want use.
def connectionlost(self, reason): self.factory.numprotocols = self.factory.numprotocols-1 // stuff for more references:
http://twistedmatrix.com/documents/12.2.0/core/howto/servers.html#auto2