在Twisted Python中使用stdio.StandardIO进行键盘输入
我在使用Twisted Python编写多客户端聊天服务器程序时有个疑问。
也就是说,当我们通过键盘输入内容,使用的是stdio.StandardIO
,那么在运行反应器(reactor)时,这些输入内容是存储在哪里的呢?有没有人能告诉我答案呢?
1 个回答
7
twisted.internet.stdio.StandardIO
并不会“存储”数据。它其实是一个传输工具,你可以把它和某种协议关联起来。你关联的这个协议可以对传递给它的数据进行任何你想要的操作。
在 Twisted 的文档中,你可以找到两个使用 StandardIO
的例子,分别是 https://twistedmatrix.com/documents/current/_downloads/stdin.py 和 https://twistedmatrix.com/documents/current/_downloads/stdiodemo.py。