twisted helloworld
来源:互联网 发布:9 9乘法口诀c语言 编辑:程序博客网 时间:2024/05/17 10:08
A simple twisted program which can be served as a helloworld of twisted.
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
class QOTD(Protocol):
def connectionMade(self):
self.transport.write(self.factory.quote+'/r/n')
self.transport.loseConnection()
class QOTDFactory(Factory):
protocol = QOTD
def __init__(self, quote=None):
self.quote = quote or 'An apple a day keeps the doctor away'
reactor.listenTCP(8007, QOTDFactory("configurable quote"))
reactor.run(
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
class QOTD(Protocol):
def connectionMade(self):
self.transport.write(self.factory.quote+'/r/n')
self.transport.loseConnection()
class QOTDFactory(Factory):
protocol = QOTD
def __init__(self, quote=None):
self.quote = quote or 'An apple a day keeps the doctor away'
reactor.listenTCP(8007, QOTDFactory("configurable quote"))
reactor.run(
- twisted helloworld
- twisted
- Twisted
- Twisted
- 说说 Twisted
- 安装Twisted
- twisted 地址
- Twisted 阐述
- twisted 入门教程
- twisted入门
- twisted deferred
- Twisted入门教程
- Twisted 知识
- twisted 2
- python twisted
- twisted入门
- twisted-credentials
- twisted+sftp
- gridview控件的一些外观设置
- XML 与 Java 技术: 用 Castor 进行数据绑定
- 使用Castor XML
- jsp自定义标签库开发
- 一些资源管理器常常设计成单例模式
- twisted helloworld
- 单例对象问题
- Castor的XML数据绑定应用
- Castor进行XML数据绑定时的一点问题
- (java)关于toString()
- java 程序员像什么
- 隐形的翅膀
- Spring事务管理
- u-boot在lpc2294上移植,串口终于出数据了!!!