[Python-Dev] Synchronous and Asynchronous servers in the standard library

Josiah Carlson jcarlson at uci.edu
Wed Nov 10 19:38:06 CET 2004

James Y Knight <foom at fuhm.net> wrote:
> On Nov 10, 2004, at 2:36 AM, Martin v. Löwis wrote:
> > My point here is that you just cannot use the very same class for
> > SMTP, and SMTP+STARTTLS - you indicated that a subclass must be
> > created. This was my original point: you cannot instantiate the
> > baseclass for use with TLS, as the baseclass does not implement
> > the cmd_STARTTLS method.
> False. STARTTLS is part of the SMTP protocol and is always implemented, 
> as shown in JP's message. Therefore, there is no subclass, STARTTLS is 
> part of the main SMTP class.

False.  ESMTP has /optional/ support for STARTTLS, as defined in RFC
3207.  Neither SMTP nor ESMTP compliant mail servers need to implement
STARTTLS, regardless of their compliance to SMTP or ESMTP.

> But, the real point is that you can use the same class for SMTP and 
> SMTP-over-ssl, which is fortunate, because you need to switch to the 
> over-ssl implementation half way through the connection.

You statement is a no-op.  One could implement the greater part of most
any application in a single class, the question is about how much can be

At the minimal level, self.send() and self.recv() need to have different
implementations for the different with/without SSL variants (assuming
one would merely wrap the bare socket).  No surprise there.  At a higher
level, because SSL-ifying a socket is a blocking operation (requires at
least one round-trip if I remember correctly), discussion about async
SMTP+TLS is pretty moot at this point (unless one uses/abuses tlslite).

> This discussion really seems useless to me. Asyncore certainly has some 
> serious deficiencies, and arguing each and every one of them is okay 
> because alternatively "nobody needs that feature" or "If X worked in 
> some way (which it doesn't), then everything would be fine" just seems 
> silly. I've only started developing with Twisted fairly recently, so I 
> don't know the entire history of its development, but I'm pretty sure 
> it wasn't started just for fun...

Asyncore was written to scratch Sam Rushing's itch.  I'm not up on
Twisted's history.

 - Josiah

More information about the Python-Dev mailing list