[ENH] StreamingSocket

David T. Lewis lewis at mail.msen.com
Sat May 13 12:38:01 UTC 2000


On Fri, May 12, 2000 at 07:26:00PM +0200, Stefan Matthias Aust wrote:
> The current way to use Sockets sucks, IMHO of course.  Therefore I like 
> Ken's approach to provide a more stream-like interface.  As with Files, I 
> have to say that the Java API for Sockets is much better and easier to use.
> 
> However, instead of subclassing Socket, I'd propose to have a subclass of 
> Stream which delegates to a socket.  Actually, it could be a subclass of an 
> external buffered stream, a class from which one could probably also 
> subclass a buffered file io class.
> 
> Comments?

I think you are right. Long term, I would also suggest some refactoring
of the FileStream and Socket stuff such that:

- Streams and protocols are not directly responsible for external I/O.
- Some other class hierarchy owns resposibility for all external I/O
  channels.
- Sockets, Files, Unix pipes, AsyncFiles, etc are all the "same thing"
  from the point of view of the streams and protocols that use them.

I did some tinkering around with the representation of external I/O
channels a while ago. It's definitely not intended for general use,
but perhaps helps get the idea across: see the page for IOHandle at
http://minnow.cc.gatech.edu/squeak/996 if interested. I've done some
additional work on IOHandle since then, but it's too messy to post at
the moment.

Dave





More information about the Squeak-dev mailing list