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


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -