twisted 的epoll 爽歪歪

    技术2022-05-19  26

    from twisted.internet import epollreactor

    epollreactor.install()

    from twisted.internet import reactor

    from twisted.internet.protocol import Protocol,Factory

    from twisted.protocols.basic import LineReceiver

     

    class EchoServer(Protocol):

    def connectionMade(self):

    print 'Get connection from',self.transport.client

    def lineReceived(self,line):

    self.transport.write(line)

    factory = Factory()

    factory.protocol = EchoServer

     

    port = 1234

    reactor.listenTCP(port,factory)

    reactor.run()


    最新回复(0)