Initial import to Tizen
[profile/ivi/python-twisted.git] / doc / core / howto / tutorial / listings / finger / finger06.py
1 # Read username, output from empty factory, drop connections
2
3 from twisted.internet import protocol, reactor
4 from twisted.protocols import basic
5
6 class FingerProtocol(basic.LineReceiver):
7     def lineReceived(self, user):
8         self.transport.write(self.factory.getUser(user)+"\r\n")
9         self.transport.loseConnection()
10
11 class FingerFactory(protocol.ServerFactory):
12     protocol = FingerProtocol
13
14     def getUser(self, user):
15         return "No such user"
16
17 reactor.listenTCP(1079, FingerFactory())
18 reactor.run()