Reactor 预览(Reactor Overview) -- dreamingk [2004-08-09 01:53:17]

Reacotr 基础(Reactor Basics)

This HOWTO introduces the Twisted reactor, describes the basics of the reactor and links to

这份HOWTO文档介绍了Twisted中的reactor,描述了reactor的基础和相关内容

Reactor基础(Reactor Basics)

The reactor is the core of the event loop within Twisted -- the loop which drives applications using Twisted. The reactor provides basic interfaces to a number of services, including network communications, threading, and event dispatching.

Reactor是Twisted事件循环的核心-使用Twiested的应用程序就是靠这个事件循环来驱动.Reactor提供了一些基本的服务接口,包括网络通讯,线程和事件分发.

For information about using the reactor and the Twisted event loop, see:

关于如果如何使用reactor和Twisted事件循环,参见

the event dispatching howtos: Scheduling and Using Deferreds; the communication howtos: TCP servers, TCP clients, UDP networking and Using processes; and Using threads.

事件分发 howtos: "调度"和"使用"Deferreds" 通讯howtos: "TCP服务器","TCP客户端","UDP网络"和"使用进程"; 以及 "使用线程"

There are multiple implementations of the reactor, each modified to provide better support for specialized features over the default implementation. More information about these and how to use a particular implementation is available via Choosing a Reactor.

Reactor有很多各不同的实现,每个实现都在缺省实现的基础上对某些特性提供了更好的支持.更多的信息和关于如何使用这些特性参见"选择Reactor"

Twisted applications can use the interfaces in twisted.application.service to configure and run the application instead of using boilerplate reactor code. See Using Application for an introduction to Application.

Twisted应用程序可以使用twisted.application.service中提供的接口来配置和运行应用程序,而不是使用像reactor的示例代码那样去运行.更多介绍请参考"使用应用"

使用reactor对象(Using the reactor object)

You can get to the reactor object using the following code:

你可以通过如下代码得到reactor:

from twisted.internet import reactor

The reactor usually implements a set of interfaces, but depending on the chosen reactor and the platform, some of the interfaces may not be implemented:

Reactor通常实现了以下一组接口,但是根据选择的不同reactor和运行平台,一些接口可能没有实现:

返回 PyTwisted/LowLevelNetworkingEventLoop

Version: 1.3.0

PyTwisted/LowLevelNetworkingEventLoop/LLNEL2 (last edited 2009-12-25 07:12:52 by localhost)

Loading