On Fri, 20 Dec 2013 01:06:29 -0800
Glyph <[email protected]> wrote:
> 
> You're right that there should be an abstraction barrier here.  In Twisted, 
> the abstraction here is called an "endpoint".  However, while this 
> abstraction should not have to be part of every protocol, it is also not part 
> of every transport.  A transport is an object that can move some bytes 
> around.  "Re-connecting" is not necessarily part of that contract, even for a 
> "client" transport.  The fact that TCP client superficially makes it possible 
> to do this is misleading.

This is true, but then reconnect() can simply raise
NotImplementedError.

> Consider a serial port.  You "connect" to a serial transport because control 
> over a serial port is exclusive.  However, if the connection is lost (i.e. 
> the serial device is removed) there's no sensible thing for "reconnect" to 
> mean.

Same answer :-)

Regards

Antoine.


Reply via email to