twisted.internet.protocol.Factory.html   [plain text]


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>twisted.internet.protocol.Factory</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">

<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="twisted.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://twistedmatrix.com/">Twisted&nbsp;1.3.0rc1</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <font size="-1"><b class="breadcrumbs">
        <a href="twisted.html">Package&nbsp;twisted</a> ::
        <a href="twisted.internet.html">Package&nbsp;internet</a> ::
        <a href="twisted.internet.protocol.html">Module&nbsp;protocol</a> ::
        Class&nbsp;Factory
      </b></font></br>
    </td>
    <td><table cellpadding="0" cellspacing="0">
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="twisted.internet.protocol.Factory.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
    </table></td>
</tr></table>

<!-- =========== START OF CLASS DESCRIPTION =========== -->
<h2 class="class">Class Factory</h2>

<dl><dt><b>Known Subclasses:</b></dt>
<dd>
    <a href="twisted.spread.pb.BrokerFactory.html"><code>BrokerFactory</code></a>,
    <a href="twisted.internet.protocol.ClientFactory.html"><code>ClientFactory</code></a>,
    <a href="twisted.protocols.irc.DccSendFactory.html"><code>DccSendFactory</code></a>,
    <a href="twisted.protocols.ftp.DTPFactory.html"><code>DTPFactory</code></a>,
    <a href="twisted.web.woven.flashconduit.FlashConduitFactory.html"><code>FlashConduitFactory</code></a>,
    <a href="twisted.protocols.ftp.FTPFactory.html"><code>FTPFactory</code></a>,
    <a href="twisted.words.ircservice.IRCGateway.html"><code>IRCGateway</code></a>,
    <a href="twisted.im.proxyui.IRCUIFactory.html"><code>IRCUIFactory</code></a>,
    <a href="twisted.protocols.portforward.ProxyFactory.html"><code>ProxyFactory</code></a>,
    <a href="twisted.internet.protocol.ServerFactory.html"><code>ServerFactory</code></a>,
    <a href="twisted.manhole.telnet.ShellFactory.html"><code>ShellFactory</code></a>,
    <a href="twisted.protocols.socks.SOCKSv4Factory.html"><code>SOCKSv4Factory</code></a>,
    <a href="twisted.protocols.socks.SOCKSv4IncomingFactory.html"><code>SOCKSv4IncomingFactory</code></a>,
    <a href="twisted.conch.ssh.factory.SSHFactory.html"><code>SSHFactory</code></a>,
    <a href="twisted.conch.ssh.forwarding.SSHListenForwardingFactory.html"><code>SSHListenForwardingFactory</code></a>,
    <a href="twisted.conch.client.unix.SSHUnixServerFactory.html"><code>SSHUnixServerFactory</code></a>,
    <a href="twisted.protocols.toc.TOCFactory.html"><code>TOCFactory</code></a></dd></dl>

<hr/>

<p>This is a factory which produces protocols.</p>
By default, buildProtocol will create a protocol of the class given in 
self.protocol.
<hr/>


<!-- =========== START OF METHOD SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Method Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="twisted.internet.protocol.Factory.html#buildProtocol" class="summary-sig-name"><code>buildProtocol</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>addr</span>)</span></code>
<br />
Create an instance of a subclass of Protocol.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="twisted.internet.protocol.Factory.html#doStart" class="summary-sig-name"><code>doStart</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
Make sure startFactory is called.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="twisted.internet.protocol.Factory.html#doStop" class="summary-sig-name"><code>doStop</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
Make sure stopFactory is called.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="twisted.internet.protocol.Factory.html#startFactory" class="summary-sig-name"><code>startFactory</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
This will be called before I begin listening on a Port or 
Connector.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="twisted.internet.protocol.Factory.html#stopFactory" class="summary-sig-name"><code>stopFactory</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
This will be called before I stop listening on all 
Ports/Connectors.</td></tr>
</table><br />


<!-- =========== START OF CLASS VARIABLE SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Class Variable Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>tuple</code></font></td>
<td><b><a href="twisted.internet.protocol.Factory.html#__implements__"><code>__implements__</code></a></b> = <span title="(&lt;class twisted.internet.interfaces.IProtocolFactory at 0x827f7bc&gt;,)"><code>(&lt;class&nbsp;twisted.internet.interfaces.IPr<span class="variable-ellipsis">...</span></code>
</span></td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>str</code></font></td>
<td><b><a href="twisted.internet.protocol.Factory.html#noisy"><code>noisy</code></a></b> = <span title="'sure, why not'"><code><span class="variable-quote">'</span>sure,&nbsp;why&nbsp;not<span class="variable-quote">'</span>                                  </code>
</span></td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>int</code></font></td>
<td><b><a href="twisted.internet.protocol.Factory.html#numPorts"><code>numPorts</code></a></b> = <span title="0">0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>NoneType</code></font></td>
<td><b><a href="twisted.internet.protocol.Factory.html#protocol"><code>protocol</code></a></b> = <span title="None">None&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>
</table><br />


<!-- =========== START OF METHOD DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Method Details</th></tr>
</table>

<a name="buildProtocol"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">buildProtocol</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>addr</span>)</span>
  </h3>
  <p>Create an instance of a subclass of Protocol.</p>
  <p>The returned instance will handle input on an incoming server 
  connection, and an attribute &quot;factory&quot; pointing to the 
  creating factory.</p>
  Override this method to alter how Protocol instances get 
  created.
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>addr</b></code> -
         an object implementing <a 
        href="twisted.internet.interfaces.IAddress.html" 
        class="link"><code>twisted.internet.interfaces.IAddress</code></a>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="doStart"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">doStart</span>(<span class=sig-arg>self</span>)</span>
  </h3>
  Make sure startFactory is called.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="doStop"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">doStop</span>(<span class=sig-arg>self</span>)</span>
  </h3>
  Make sure stopFactory is called.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="startFactory"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">startFactory</span>(<span class=sig-arg>self</span>)</span>
  </h3>
  <p>This will be called before I begin listening on a Port or 
  Connector.</p>
  <p>It will only be called once, even if the factory is connected to 
  multiple ports.</p>
  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.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="stopFactory"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">stopFactory</span>(<span class=sig-arg>self</span>)</span>
  </h3>
  <p>This will be called before I stop listening on all 
  Ports/Connectors.</p>
  <p>This can be used to perform 'shutdown' tasks such as disconnecting 
  database connections, closing files, etc.</p>
  It will be called, for example, before an application shuts down, if 
  it was connected to a port.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>
<br />


<!-- =========== START OF CLASS VARIABLE DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Class Variable Details</th></tr>
</table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="__implements__"></a>
<h3>__implements__</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <code>tuple</code>

      </dd>
<span title="(&lt;class twisted.internet.interfaces.IProtocolFactory at 0x827f7bc&gt;,)">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
(&lt;class twisted.internet.interfaces.IProtocolFactory at 0x827f7bc&gt;,)   </pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="noisy"></a>
<h3>noisy</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <code>str</code>

      </dd>
<span title="'sure, why not'">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
<span class="variable-quote">'</span>sure, why not<span class="variable-quote">'</span>                                                        </pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="numPorts"></a>
<h3>numPorts</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <code>int</code>

      </dd>
<span title="0">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="protocol"></a>
<h3>protocol</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <code>NoneType</code>

      </dd>
<span title="None">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
None&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<br />


<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="twisted.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://twistedmatrix.com/">Twisted&nbsp;1.3.0rc1</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="left"><font size="-2">Generated by Epydoc 2.0 on Sat May 15 20:08:14 2004</font></td>
    <td align="right"><a href="http://epydoc.sourceforge.net"
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
  </tr>
</table>
</body>
</html>