【发布时间】:2015-08-10 21:23:23
【问题描述】:
我希望编写一个可以通过多个套接字连接到服务器的 Twisted 客户端应用程序。我希望使用工厂、协议、传输模型,因为它们似乎提供了一个很好的框架。 interfaces、Protocol 和 ProcessProtocol 都继承自 BaseProtocol,但它们有何不同? ProcessProtocol 是协议池吗?特别是ProcessProtocol中的子进程是什么,能不能把它当成socket对象呢?
IProtocol(Interface):
dataReceived(data)
connectionLost(reason)
makeConnection(transport)
connectionMade()
IProcessProtocol(Interface):
childDataReceived(childFD, data)
childConnectionLost(childFD)
processExited(reason)
processEnded(reason)
编辑:发现 ProcessProtocol 实际上可能正在启动 python 进程。
【问题讨论】:
标签: python sockets twisted twisted.web