[Twisted-Python] COMMERCIAL:Re: Is there a nice way to writetransport-agnostic protocols and servers/clients?

Barry Scott barry.scott at forcepoint.com
Thu Aug 17 03:01:59 MDT 2017


On Thursday, 17 August 2017 03:03:41 BST Kevin Conway wrote:
> > There is no datagram endpoints API as yet, though (see #4471), only
> 
> stream endpoints.
> 
> I'm not sure I understand the distinction. Endpoints supports UDP which is
> a datagram based transport. From a Protocol perspective, you only care
> about which bytes are received. If you have a framing concept I'm your data
> format then it should be handled there.

streams like TCP will reliably deliver what you send.
but UDP makes no gareentee 

> 
> What am I not understanding about this particular use case?
> 
> On Wed, Aug 16, 2017, 16:25 Jean-Paul Calderone <exarkun at twistedmatrix.com>
> 
> wrote:
> > On Wed, Aug 16, 2017 at 9:59 AM, Tristan Seligmann <
> > 
> > mithrandi at mithrandi.net> wrote:
> >> On Wed, 16 Aug 2017 at 15:28 Kevin Conway <kevinjacobconway at gmail.com>
> >> 
> >> wrote:
> >>> Maybe I misunderstand the issue, but I believe the Endpoints API solves
> >>> for this.
> >>> https://twistedmatrix.com/documents/16.4.1/core/howto/endpoints.html
> >>> 
> >>> This abstracts the transport and allows you to focus on only
> >>> interpreting the bytes transmitted over that transport by defining a
> >>> Protocol and a Factory that plug into strports. This should allow you to
> >>> have the business logic defined in only one location while
> >>> listening/requesting over different transports.
> >> 
> >> There is no datagram endpoints API as yet, though (see #4471), only
> >> stream endpoints.
> > 
> > Also, when there are datagram endpoints, they won't be compatible with
> > stream endpoints.  Endpoints don't abstract the transport, they abstract
> > *creating* the transport.
> > 
> > Twisted provides a uniform abstraction over stream-based transports like
> > TCP and gives you *ITransport* to implement an *IProtocol* against.  It
> > also provides a uniform abstraction over datagram-based transports like
> > UDP
> > and gives you *IUDPTransport* (oops; should have been *IDatagramTransport*
> > and some other things about it should probably be changed too) to
> > implement a *DatagramProtocol* (oops; no interface for this one, just
> > subclass: see, this should change) against.  But it doesn't provide a
> > uniform abstraction over both stream-based and datagram-based transports.
> > 
> > Implementing such a thing may be possible and even a good idea but no one
> > has yet done it for Twisted (as far as I know).
> > 
> > Jean-Paul
> > 
> > _______________________________________________
> > Twisted-Python mailing list
> > Twisted-Python at twistedmatrix.com
> > https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list