1
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
3
<title>Twisted Documentation: Twisted code examples</title>
4
<link href="../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
8
<h1 class="title">Twisted code examples</h1>
9
<div class="toc"><ol><li><a href="#auto0">Simple Echo server and client</a></li><li><a href="#auto1">Chat</a></li><li><a href="#auto2">Echo server & client variants</a></li><li><a href="#auto3">AMP server & client variants</a></li><li><a href="#auto4">Perspective Broker</a></li><li><a href="#auto5">ROW (Twisted Enterprise)</a></li><li><a href="#auto6">Cred</a></li><li><a href="#auto7">GUI</a></li><li><a href="#auto8">FTP examples</a></li><li><a href="#auto9">Logging</a></li><li><a href="#auto10">Miscellaneous</a></li></ol></div>
13
<h2>Simple Echo server and client<a name="auto0"/></h2>
15
<li><a href="simpleclient.py" shape="rect">simpleclient.py</a> - simple TCP client</li>
16
<li><a href="simpleserv.py" shape="rect">simpleserv.py</a> - simple TCP echo server</li>
19
<h2>Chat<a name="auto1"/></h2>
21
<li><a href="chatserver.py" shape="rect">chatserver.py</a> - shows how to communicate between clients</li>
24
<h2>Echo server & client variants<a name="auto2"/></h2>
26
<li><a href="echoserv.py" shape="rect">echoserv.py</a> - variant on a simple TCP echo server</li>
27
<li><a href="echoclient.py" shape="rect">echoclient.py</a> - variant on a simple TCP client</li>
28
<li><a href="echoserv_udp.py" shape="rect">echoserv_udp.py</a> - simplest possible
30
<li><a href="echoclient_udp.py" shape="rect">echoclient_udp.py</a> - simple UDP
32
<li><a href="echoserv_ssl.py" shape="rect">echoserv_ssl.py</a> - simple SSL server</li>
33
<li><a href="echoclient_ssl.py" shape="rect">echoclient_ssl.py</a> - simple SSL client</li>
36
<h2>AMP server & client variants<a name="auto3"/></h2>
38
<li><a href="ampserver.py" shape="rect">ampserver.py</a> - do math using AMP</li>
39
<li><a href="ampclient.py" shape="rect">ampclient.py</a> - do math using AMP</li>
42
<h2>Perspective Broker<a name="auto4"/></h2>
44
<li><a href="pbsimple.py" shape="rect">pbsimple.py</a> - simplest possible PB server</li>
45
<li><a href="pbsimpleclient.py" shape="rect">pbsimpleclient.py</a> - simplest possible PB
47
<li><a href="pbbenchclient.py" shape="rect">pbbenchclient.py</a> - benchmarking client</li>
48
<li><a href="pbbenchserver.py" shape="rect">pbbenchserver.py</a> - benchmarking server</li>
49
<li><a href="pbecho.py" shape="rect">pbecho.py</a> - echo server that uses login</li>
50
<li><a href="pbechoclient.py" shape="rect">pbechoclient.py</a> - echo client using login</li>
51
<li><a href="pb_exceptions.py" shape="rect">pb_exceptions.py</a> - example of exceptions over PB</li>
52
<li><a href="pbgtk2.py" shape="rect">pbgtk2.py</a> - example of using GTK2 with PB</li>
53
<li><a href="pbinterop.py" shape="rect">pbinterop.py</a> - shows off various types supported by PB</li>
54
<li><a href="bananabench.py" shape="rect">bananabench.py</a> - benchmark for banana</li>
57
<h2>ROW (Twisted Enterprise)<a name="auto5"/></h2>
59
<li><a href="row_example.py" shape="rect">row_example.py</a> - using twisted.enterpise.row to load objects
60
from a database and manipulate them.</li>
61
<li><a href="row_schema.sql" shape="rect">row_schema.sql</a> - sample statements to populate tables for
63
<li><a href="row_util.py" shape="rect">row_util.py</a> - definitions of row classes for
67
<h2>Cred<a name="auto6"/></h2>
69
<li><a href="cred.py" shape="rect">cred.py</a> - Authenticate a user with an in-memory username/password
71
<li><a href="dbcred.py" shape="rect">dbcred.py</a> - Using a database backend to authenticate a user</li>
74
<h2>GUI<a name="auto7"/></h2>
76
<li><a href="wxdemo.py" shape="rect">wxdemo.py</a> - demo of wxPython integration with Twisted</li>
77
<li><a href="pbgtk2.py" shape="rect">pbgtk2.py</a> - example of using GTK2 with PB</li>
78
<li><a href="pyuidemo.py" shape="rect">pyuidemo.py</a> - PyUI</li>
81
<h2>FTP examples<a name="auto8"/></h2>
83
<li><a href="ftpclient.py" shape="rect">ftpclient.py</a> - example of using the FTP client</li>
84
<li><a href="ftpserver.py" shape="rect">ftpserver.py</a> - create an FTP server which
85
serves files for anonymous users from the working directory and serves
86
files for authenticated users from <code class="shell">/home</code>.</li>
89
<h2>Logging<a name="auto9"/></h2>
91
<li><a href="twistd-logging.tac" shape="rect">twistd-logging.tac</a> - logging example using
93
<li><a href="testlogging.py" shape="rect">testlogging.py</a> - use twisted.python.log to log errors to
95
<li><a href="rotatinglog.py" shape="rect">rotatinglog.py</a> - example of log file rotation</li>
98
<h2>Miscellaneous<a name="auto10"/></h2>
100
<li><a href="shaper.py" shape="rect">shaper.py</a> - example of rate-limiting your web server</li>
101
<li><a href="stdiodemo.py" shape="rect">stdiodemo.py</a> - example using stdio, Deferreds, LineReceiver
102
and twisted.web.client.</li>
103
<li><a href="mouse.py" shape="rect">mouse.py</a> - example using MouseMan protocol with the SerialPort
105
<li><a href="ptyserv.py" shape="rect">ptyserv.py</a> - serve shells in pseudo-terminals over TCP</li>
106
<li><a href="courier.py" shape="rect">courier.py</a> - example of interfacing to Courier's mail filter
108
<li><a href="longex.py" shape="rect">longex.py</a> - example of doing arbitarily long calculations nicely
110
<li><a href="longex2.py" shape="rect">longex2.py</a> - using generators to do long calculations</li>
111
<li><a href="stdin.py" shape="rect">stdin.py</a> - reading a line at a time from standard input
112
without blocking the reactor.</li>
113
<li><a href="filewatch.py" shape="rect">filewatch.py</a> - write the content of a file to standard out
114
one line at a time</li>
115
<li><a href="shoutcast.py" shape="rect">shoutcast.py</a> - example Shoutcast client</li>
116
<li><a href="gpsfix.py" shape="rect">gpsfix.py</a> - example using the SerialPort transport and GPS
117
protocols to display fix data as it is received from the device</li>
118
<li><a href="wxacceptance.py" shape="rect">wxacceptance.py</a> - acceptance tests for wxreactor</li>
119
<li><a href="postfix.py" shape="rect">postfix.py</a> - test application for PostfixTCPMapServer</li>
124
<p><a href="../howto/index.html">Index</a></p>
125
<span class="version">Version: 10.0.0</span>
b'\\ No newline at end of file'