As far as I can understand streams are of a fixed size, whether they are memory or file streams. Is there a term for an open ended stream like a serial port or a network socket connection?
I’m working in Delphi XE. I’ve looked at classes that are decended from TStream. I would like to make an interface to a general class that would apply to a serial port, network socket, keyboard entry or simulated data. These would be data flow of no specifed length, containing packets of usable data.
I’m at a loss for the proper search term. Maybe the right term is a socket, but that seems to be a more specific network term.
Stream, pipeline, socket, file, whatever… they are all similar, in the following:
In the POSIX/UNIX world, for instance, “everything is a file”, even a network, a setting, a cpu, a device…
In Delphi, you can perfectly inherits from a
TStreamto implement this behavior.Even the
Seekmethod does not need to handle all the cases. You can have one-way / unidirectional streams, read-only or write-only stream.Then you can share the same code with diverse
TStreamimplementations, to/from a file, a network, some memory, the keyboard, a screen, whatever… You can even nest streams, in order to add on-the-fly compression, encryption, replication…So if you are in the Delphi world, just call it “stream”, implements a
TStream… and happy coding!