|
Size: 2806
Comment:
|
Size: 2804
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 15: | Line 15: |
| * [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.interfaces.IReactorProcess.html | * [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.interfaces.IReactorProcess.html "twisted.internet.interfaces.IReactorProcess"] |
| Line 17: | Line 17: |
| twisted.internet.interfaces.IReactorProcess] * [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.interfaces.IProcessTransport.html |
* [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.interfaces.IProcessTransport.html "twisted.internet.interfaces.IProcessTransport"] |
| Line 20: | Line 19: |
| twisted.internet.interfaces.IProcessTransport] * [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.protocol.ProcessProtocol.html twisted.internet.protocol.ProcessProtocol] |
* [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.protocol.ProcessProtocol.html "twisted.internet.protocol.ProcessProtocol"] |
使用进程(Using Processes) -- Jerry Marx 于 [DateTime(2004-08-18T18:28:47Z)] 最后编辑 TableOfContents
概述(Overview)
Along with connection to servers across the internet, Twisted also connects to local processes with much the same API. The API is described in
more detail in the documentation of:
就像通过网络连接到服务器上一样,Twisted也可以使用相同的API连接到本地进程.这些API的详细文档如下:
* [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.interfaces.IReactorProcess.html "twisted.internet.interfaces.IReactorProcess"]
* [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.interfaces.IProcessTransport.html "twisted.internet.interfaces.IProcessTransport"]
* [http://twistedmatrix.com/documents/TwistedDocs/TwistedDocs-1.3.0/api/twisted.internet.protocol.ProcessProtocol.html "twisted.internet.protocol.ProcessProtocol"]
运行另一个进程(Running Another Processes)
Processes are run through the reactor, using reactor.spawnProcess(). Pipes are created to the child process, and added to the reactor core so that
the application will not block while sending data into or pulling data out of the new process. reactor.spawnProcess() requires two arguments,
processProtocol and executable, and optionally takes six more: arguments, environment, path, userID, groupID, and usePTY.
进程通过反应器(reactor)的成员函数reactor.spawnProcess()运行. 同时创建一个通向子进程的管道(pipe),由于管道是被加到反应器核
心的,所以应用程序不会被阻塞. 在向新进程发送数据或者从新进程接收数据的时候, reactor.spawnProcess()需要两个参数,
processProtocol和excutable,还有其它留个可选参数: arguments,environment,path,userID,groupID和usePTY.
写一个进程协议(Writing a ProcessProtocol)
进程协议会发生什么事情(Things that can happen to your ProcessProtocol)
你可以从进程协议做什么(Things you can do from your ProcessProtocol)
Verbose例子(Verbose Example)
容易一些(Doing ti the Easy Way)
映射文件描述符(Mapping File Descriptors)
有文件描述符的进程协议(ProcessProtocols with extra file descriptors)
例子
- 翻译 -- Jerry Marx.
[http://wiki.woodpecker.org.cn/moin.cgi/PyTwisted_2fLowLevelNetworkingEventLoop (目录)Index]
Version: 1.3.0
