Table of Contents

Class: Factory | Twisted-0.17.4/twisted/protocols/protocol.py
--- | ---

### This is a factory which produces protocols.

By default, buildProtocol will create a protocol of the class given in self.protocol.

Methods |
--- | ---
buildProtocol startFactory stopFactory
| buildProtocol

    buildProtocol ( self,  addr )

### Create an instance of a subclass of Protocol.

The returned instance will handle input on an incoming server connection, and an attribute "factory" pointing to the creating factory. If None is returned, the connection is assumed to have been refused, and the Port will close the connection.

Override this method to alter how Protocol instances get created.

| startFactory

    startFactory ( self )

### This will be called before I begin listening on a Port.

This can be used to perform `unserialization` tasks that are best put off until things are actually running, such as connecting to a database, opening files, etcetera.

It will be called both after an application has been unserialized and before all the ports begin accepting connections.

| stopFactory

    stopFactory ( self )

### This will be called before I stop listening on a Port.

This can be used to perform `shutdown` tasks such as disconnecting database connections, closing files, etc.

It will be called before an application shuts down.

Table of Contents

This document was automatically generated on Sat Apr 20 01:31:04 2002 by HappyDoc version 2.0