[Python-checkins] peps: Add high-level explanation of transports and protocols early on.

guido.van.rossum python-checkins at python.org
Mon Mar 18 23:43:12 CET 2013


http://hg.python.org/peps/rev/3d706be6e879
changeset:   4807:3d706be6e879
user:        Guido van Rossum <guido at python.org>
date:        Mon Mar 18 15:43:00 2013 -0700
summary:
  Add high-level explanation of transports and protocols early on.

files:
  pep-3156.txt |  41 ++++++++++++++++++++++++++++++++++++++++
  1 files changed, 41 insertions(+), 0 deletions(-)


diff --git a/pep-3156.txt b/pep-3156.txt
--- a/pep-3156.txt
+++ b/pep-3156.txt
@@ -76,6 +76,47 @@
 PEP 3148) which returns a Future that is compatible with the event
 loop.
 
+A Note About Transports and Protocols
+-------------------------------------
+
+For those not familiar with Twisted, a quick explanation of the
+difference between transports and protocols is in order.  At the
+highest level, the transport is concerned with *how* bytes are
+transmitted, while the protocol determines *which* bytes to transmit
+(and when).
+
+A transport represents a pair of streams (one in each direction) that
+each transmit a sequence of bytes.  The most common transport is
+probably the TCP connection.  Another common transport is SSL.  But
+there are some other things that can be viewed as transports, for
+example an SSH session or a pair of UNIX pipes.  Typically there
+aren't many different transport implementations, and most of them
+come with the event loop implementation.
+
+A transport has two "sides": one side talks to the network (or the
+subprocess, or whatever low-level interface it wraps), and the other
+side talks to the protocol.  The former uses whatever API is necessary
+to implement the transport; but the interface between transport and
+protocol is standardized by this PEP.
+
+A protocol represents some kind of "application-level" protocol such
+as HTTP or SMTP.  Its primary interface is with the transport.  While
+some popular protocols will probably have a standard implementation,
+often applications implement custom protocols.  It also makes sense to
+have libraries of useful 3rd party protocol implementations that can
+be downloaded and installed from pypi.python.org.
+
+There is also a somewhat more general notion of transport and
+protocol, where the transport wraps some other communication
+abstraction.  Example include an interface for sending and receiving
+datagrams, or a subprocess manager.  The separation of concerns is the
+same as for stream transports and protocols, but the specific
+interface between transport and protocol can be different in each
+case.
+
+Details of the interfaces between transports and protocols are given
+later.
+
 
 Non-goals
 =========

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list