1
<?xml version="1.0" encoding="iso-8859-1"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
"DTD/xhtml1-transitional.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
<title>twisted.protocols.policies.ProtocolWrapper</title>
7
<link rel="stylesheet" href="epydoc.css" type="text/css"></link>
9
<body bgcolor="white" text="black" link="blue" vlink="#204080"
12
<!-- =========== START OF NAVBAR =========== -->
13
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
15
<th class="navbar"> <a class="navbar" href="twisted.html">Home</a> </th>
16
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
17
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
18
<th class="navbar"> <a class="navbar" href="help.html">Help</a> </th>
19
<th class="navbar" align="right" width="100%">
20
<table border="0" cellpadding="0" cellspacing="0">
21
<tr><th class="navbar" align="center">
23
<a class="navbar" target="_top" href="http://twistedmatrix.com/">Twisted 1.3.0rc1</a>
24
</p></th></tr></table>
28
<table width="100%" cellpadding="0" cellspacing="0">
31
<font size="-1"><b class="breadcrumbs">
32
<a href="twisted.html">Package twisted</a> ::
33
<a href="twisted.protocols.html">Package protocols</a> ::
34
<a href="twisted.protocols.policies.html">Module policies</a> ::
35
Class ProtocolWrapper
38
<td><table cellpadding="0" cellspacing="0">
39
<tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a> | <a href="twisted.protocols.policies.ProtocolWrapper.html" target="_top">no frames</a>]</font></td></tr>
43
<!-- =========== START OF CLASS DESCRIPTION =========== -->
44
<h2 class="class">Class ProtocolWrapper</h2>
46
<pre class="base-tree">
47
<a href="twisted.internet.protocol.BaseProtocol.html"><code>BaseProtocol</code></a> --+
49
<a href="twisted.internet.protocol.Protocol.html"><code>Protocol</code></a> --+
51
<b>ProtocolWrapper</b>
54
<dl><dt><b>Known Subclasses:</b></dt>
56
<a href="twisted.protocols.policies.SpewingProtocol.html"><code>SpewingProtocol</code></a>,
57
<a href="twisted.protocols.policies.ThrottlingProtocol.html"><code>ThrottlingProtocol</code></a>,
58
<a href="twisted.protocols.policies.TimeoutProtocol.html"><code>TimeoutProtocol</code></a></dd></dl>
62
Wraps protocol instances and acts as their transport as well.
66
<!-- =========== START OF METHOD SUMMARY =========== -->
67
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
68
<tr bgcolor="#70b0f0" class="summary">
69
<th colspan="2">Method Summary</th></tr>
70
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
71
<td><code><a name="__init__"></a><span class="summary-sig"><span class="summary-sig-name">__init__</span>(<span class=summary-sig-arg>self</span>,
72
<span class=summary-sig-arg>factory</span>,
73
<span class=summary-sig-arg>wrappedProtocol</span>)</span></code>
75
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
76
<td><code><a name="__getattr__"></a><span class="summary-sig"><span class="summary-sig-name">__getattr__</span>(<span class=summary-sig-arg>self</span>,
77
<span class=summary-sig-arg>name</span>)</span></code>
79
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
80
<td><code><a name="connectionLost"></a><span class="summary-sig"><span class="summary-sig-name">connectionLost</span>(<span class=summary-sig-arg>self</span>,
81
<span class=summary-sig-arg>reason</span>)</span></code>
83
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
84
<td><code><span class="summary-sig"><a href="twisted.protocols.policies.ProtocolWrapper.html#connectionMade" class="summary-sig-name"><code>connectionMade</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
86
Called when a connection is made.</td></tr>
87
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
88
<td><code><span class="summary-sig"><a href="twisted.protocols.policies.ProtocolWrapper.html#dataReceived" class="summary-sig-name"><code>dataReceived</code></a>(<span class=summary-sig-arg>self</span>,
89
<span class=summary-sig-arg>data</span>)</span></code>
91
Called whenever data is received.</td></tr>
92
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
93
<td><code><a name="getHost"></a><span class="summary-sig"><span class="summary-sig-name">getHost</span>(<span class=summary-sig-arg>self</span>)</span></code>
95
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
96
<td><code><a name="getPeer"></a><span class="summary-sig"><span class="summary-sig-name">getPeer</span>(<span class=summary-sig-arg>self</span>)</span></code>
98
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
99
<td><code><a name="loseConnection"></a><span class="summary-sig"><span class="summary-sig-name">loseConnection</span>(<span class=summary-sig-arg>self</span>)</span></code>
101
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
102
<td><code><span class="summary-sig"><a href="twisted.protocols.policies.ProtocolWrapper.html#makeConnection" class="summary-sig-name"><code>makeConnection</code></a>(<span class=summary-sig-arg>self</span>,
103
<span class=summary-sig-arg>transport</span>)</span></code>
105
Make a connection to a transport and a server.</td></tr>
106
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
107
<td><code><a name="registerProducer"></a><span class="summary-sig"><span class="summary-sig-name">registerProducer</span>(<span class=summary-sig-arg>self</span>,
108
<span class=summary-sig-arg>producer</span>,
109
<span class=summary-sig-arg>streaming</span>)</span></code>
111
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
112
<td><code><a name="stopConsuming"></a><span class="summary-sig"><span class="summary-sig-name">stopConsuming</span>(<span class=summary-sig-arg>self</span>)</span></code>
114
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
115
<td><code><a name="unregisterProducer"></a><span class="summary-sig"><span class="summary-sig-name">unregisterProducer</span>(<span class=summary-sig-arg>self</span>)</span></code>
117
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
118
<td><code><a name="write"></a><span class="summary-sig"><span class="summary-sig-name">write</span>(<span class=summary-sig-arg>self</span>,
119
<span class=summary-sig-arg>data</span>)</span></code>
121
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
122
<td><code><a name="writeSequence"></a><span class="summary-sig"><span class="summary-sig-name">writeSequence</span>(<span class=summary-sig-arg>self</span>,
123
<span class=summary-sig-arg>data</span>)</span></code>
125
<tr bgcolor="#e8f0f8" class="group">
126
<th colspan="2"> Inherited from Protocol</th></tr>
127
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
128
<td><code><span class="summary-sig"><a href="twisted.internet.protocol.Protocol.html#connectionFailed" class="summary-sig-name"><code>connectionFailed</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
130
(Deprecated)</td></tr>
134
<!-- =========== START OF CLASS VARIABLE SUMMARY =========== -->
135
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
136
<tr bgcolor="#70b0f0" class="summary">
137
<th colspan="2">Class Variable Summary</th></tr>
138
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>tuple</code></font></td>
139
<td><b><a href="twisted.protocols.policies.ProtocolWrapper.html#__implements__"><code>__implements__</code></a></b> = <span title="(<class twisted.internet.interfaces.ITransport at 0x8254024>,)"><code>(<class twisted.internet.interfaces.ITr<span class="variable-ellipsis">...</span></code>
141
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>int</code></font></td>
142
<td><b><a href="twisted.protocols.policies.ProtocolWrapper.html#disconnecting"><code>disconnecting</code></a></b> = <span title="0">0 </span></td></tr>
143
<tr bgcolor="#e8f0f8" class="group">
144
<th colspan="2"> Inherited from BaseProtocol</th></tr>
145
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>int</code></font></td>
146
<td><b><a href="twisted.internet.protocol.BaseProtocol.html#connected"><code>connected</code></a></b> = <span title="0">0 </span></td></tr>
147
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>NoneType</code></font></td>
148
<td><b><a href="twisted.internet.protocol.BaseProtocol.html#transport"><code>transport</code></a></b> = <span title="None">None </span></td></tr>
152
<!-- =========== START OF METHOD DETAILS =========== -->
153
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
154
<tr bgcolor="#70b0f0" class="details">
155
<th colspan="2">Method Details</th></tr>
158
<a name="connectionMade"></a>
159
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
160
<h3><span class="sig"><span class="sig-name">connectionMade</span>(<span class=sig-arg>self</span>)</span>
162
<p>Called when a connection is made.</p>
163
This may be considered the initializer of the protocol, because it
164
is called when the connection is completed. For clients, this is called
165
once the connection to the server has been established; for servers,
166
this is called after an accept() call stops blocking and a socket has
167
been received. If you need to send any greeting or initial message, do
170
<dl><dt><b>Overrides:</b></dt>
171
<dd><a href="twisted.internet.protocol.BaseProtocol.html#connectionMade"><code>twisted.internet.protocol.BaseProtocol.connectionMade</code></a> <i>(inherited documentation)</i>
177
<a name="dataReceived"></a>
178
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
179
<h3><span class="sig"><span class="sig-name">dataReceived</span>(<span class=sig-arg>self</span>,
180
<span class=sig-arg>data</span>)</span>
182
<p>Called whenever data is received.</p>
183
Use this method to translate to a higher-level message. Usually,
184
some callback will be made upon the receipt of each complete protocol
187
<dl><dt><b>Parameters:</b></dt>
188
<dd><code><b>data</b></code> -
189
a string of indeterminate length. Please keep in mind that you
190
will probably need to buffer some data, as partial (or multiple)
191
protocol messages may be received! I recommend that unit tests
192
for protocols call through to this method with differing chunk
193
sizes, down to one byte at a time.
196
<dl><dt><b>Overrides:</b></dt>
197
<dd><a href="twisted.internet.protocol.Protocol.html#dataReceived"><code>twisted.internet.protocol.Protocol.dataReceived</code></a> <i>(inherited documentation)</i>
203
<a name="makeConnection"></a>
204
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
205
<h3><span class="sig"><span class="sig-name">makeConnection</span>(<span class=sig-arg>self</span>,
206
<span class=sig-arg>transport</span>)</span>
208
<p>Make a connection to a transport and a server.</p>
209
This sets the 'transport' attribute of this Protocol, and calls the
210
connectionMade() callback.
212
<dl><dt><b>Overrides:</b></dt>
213
<dd><a href="twisted.internet.protocol.BaseProtocol.html#makeConnection"><code>twisted.internet.protocol.BaseProtocol.makeConnection</code></a> <i>(inherited documentation)</i>
221
<!-- =========== START OF CLASS VARIABLE DETAILS =========== -->
222
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
223
<tr bgcolor="#70b0f0" class="details">
224
<th colspan="2">Class Variable Details</th></tr>
226
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
227
<a name="__implements__"></a>
228
<h3>__implements__</h3>
233
<dt><b>Type:</b></dt>
238
<span title="(<class twisted.internet.interfaces.ITransport at 0x8254024>,)"> <dt><b>Value:</b></dt>
240
<pre class="variable">
241
(<class twisted.internet.interfaces.ITransport at 0x8254024>,) </pre>
242
</td></tr></table></dd>
245
</dl></td></tr></table>
246
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
247
<a name="disconnecting"></a>
248
<h3>disconnecting</h3>
253
<dt><b>Type:</b></dt>
258
<span title="0"> <dt><b>Value:</b></dt>
260
<pre class="variable">
261
0 </pre>
262
</td></tr></table></dd>
265
</dl></td></tr></table>
269
<!-- =========== START OF NAVBAR =========== -->
270
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
272
<th class="navbar"> <a class="navbar" href="twisted.html">Home</a> </th>
273
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
274
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
275
<th class="navbar"> <a class="navbar" href="help.html">Help</a> </th>
276
<th class="navbar" align="right" width="100%">
277
<table border="0" cellpadding="0" cellspacing="0">
278
<tr><th class="navbar" align="center">
280
<a class="navbar" target="_top" href="http://twistedmatrix.com/">Twisted 1.3.0rc1</a>
281
</p></th></tr></table>
286
<table border="0" cellpadding="0" cellspacing="0" width="100%">
288
<td align="left"><font size="-2">Generated by Epydoc 2.0 on Sat May 15 20:07:52 2004</font></td>
289
<td align="right"><a href="http://epydoc.sourceforge.net"
290
><font size="-2">http://epydoc.sf.net</font></a></td>