Examples¶
Simple Echo server and client¶
simpleclient.py
- simple TCP clientsimpleserv.py
- simple TCP echo server
Chat¶
chatserver.py
- shows how to communicate between clients
Echo server & client variants¶
echoserv.py
- variant on a simple TCP echo serverechoclient.py
- variant on a simple TCP clientechoserv_udp.py
- simplest possible UDP serverechoclient_udp.py
- simple UDP clientechoserv_ssl.py
- simple SSL serverechoclient_ssl.py
- simple SSL client
AMP server & client variants¶
ampserver.py
- do math using AMPampclient.py
- do math using AMP
Perspective Broker¶
pbsimple.py
- simplest possible PB serverpbsimpleclient.py
- simplest possible PB clientpbbenchclient.py
- benchmarking clientpbbenchserver.py
- benchmarking serverpbecho.py
- echo server that uses loginpbechoclient.py
- echo client using loginpb_exceptions.py
- example of exceptions over PBpbgtk2.py
- example of using GTK2 with PBpbinterop.py
- shows off various types supported by PBbananabench.py
- benchmark for banana
Cred¶
GUI¶
wxdemo.py
- demo of wxPython integration with Twistedpbgtk2.py
- example of using GTK2 with PBpyuidemo.py
- PyUI
FTP examples¶
ftpclient.py
- example of using the FTP clientftpserver.py
- create an FTP server which serves files for anonymous users from the working directory and serves files for authenticated users from/home
.
Logging¶
twistd-logging.tac
- logging example using ILogObservertestlogging.py
- use twisted.python.log to log errors to standard outrotatinglog.py
- example of log file rotation
POSIX Specific Tricks¶
Miscellaneous¶
shaper.py
- example of rate-limiting your web serverstdiodemo.py
- example using stdio, Deferreds, LineReceiver and twisted.web.client.ptyserv.py
- serve shells in pseudo-terminals over TCPcourier.py
- example of interfacing to Courier’s mail filter interfacelongex.py
- example of doing arbitrarily long calculations nicely in Twistedlongex2.py
- using generators to do long calculationsstdin.py
- reading a line at a time from standard input without blocking the reactorstreaming.py
- example of a push producer/consumer systemfilewatch.py
- write the content of a file to standard out one line at a timeshoutcast.py
- example Shoutcast clientwxacceptance.py
- acceptance tests for wxreactorpostfix.py
- test application for PostfixTCPMapServerudpbroadcast.py
- broadcasting using UDPtls_alpn_npn_client.py
- example of TLS next-protocol negotiation on the client side using NPN and ALPN.tls_alpn_npn_server.py
- example of TLS next-protocol negotiation on the server side using NPN and ALPN.