[Python-3000] suggestion for a new socket io stack

Neal Norwitz nnorwitz at gmail.com
Sat Apr 29 04:07:36 CEST 2006


If you move forward with this, please review (learn from and steal the
best parts of) the ACE APIs.  http://cs.wustl.edu/~schmidt/ACE.html 
They've done a lot of work in this area and have a lot of experience. 
It would also be good to talk to the twisted guys.

We should also support epoll beyond select/poll/kqueue.

Also, the scheme should be extensible to other types of sockets that
aren't as commonly used.  Say something like X.25. :-)

n
--
On 4/28/06, Blake Winton <bwinton at latte.ca> wrote:
> tomer filiba wrote:
> > Each protocol would subclass {Stream/Dgram/Raw}Socket
> > and add its protocol-specific options.
> >
> > here's an example for a hierarchy:
> > Socket
> >     RawSocket
> >     DgramSocket
> >         UDPSocket
> >     StreamSocket
> >         TCPSocket
> >             SSLSocket
>
> My one small complaint with that is that SSLSocket should really be an
> SSL wrapper around a TCPSocket, because I wouldn't want to have two
> classes for HTTP/HTTPS, or FTP/FTPS/SFTP.  Java does something
> reasonable in this regard, I think, where you can have subclasses of
> Filter(Input,Output)Stream which can build on one-another, so I can have
> a base-64 encoded, TEA-encrypted, SSL, TCP socket by writing a line
> similar to:
> sock = TcpSocket( "129.97.134.11", 8080 )
> myIn = Base64Stream( TeaStream( SslStream( sock.getInputStream() ) ) )
> myOut = Base64Stream( TeaStream( SslStream( sock.getOutputStream() ) ) )
>
> The real beauty of that is that I can hook up my Base64Stream to a
> StringIO-like object to base64-encode stuff in memory, for testing, or
> for actual use.  Or I could Tea-encrypt a file while writing it to disk.
>
> On the downside, it's a larger change than the one you're proposing.  On
> the upside, it unifies stream sockets, strings, files, and any other
> source of stream data you can come up with (random generators?  keyboards?).
>
> Further reading of your examples suggests to me that what I would really
> like is a stream-view of the Socket class, and let SSL (, etc...) be a
> wrapper around the Socket's input/output streams.
>
> Other than that small suggestion, I quite like your proposal.
>
> Later,
> Blake.
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/nnorwitz%40gmail.com
>


More information about the Python-3000 mailing list