Forum > General

Custom low-level stuff for WriteLn() etc.

(1/3) > >>

MarkMLl:
Noting that Text -> TextRec are opaque, what's the least-overhead way of reimplementing the low-level stuff so that WriteLn() etc. may be used with custom I/O code?

I'm about to redo a Telnet server in a hurry which I anticipate will take me about ten minutes (building on something I've already got to hand), but am rather stumped by the best way of plumbing it into existing software.

I definitely don't need codepages, Unicode or anything like that, and am intent on keeping things as straightforward as possible.

MarkMLl

marcov:
Look at the streamio unit in fcl-base that redirects a textfile to a stream.

I use it a lot to upgrade haphazard scripts.

MarkMLl:
I don't see how that helps, since by the time the Telnet server has split out the data and IAC flows it no longer looks anything like a file.

Is that where a TMemoryStream comes into it? Which set of documentation should I believe: https://www.freepascal.org/docs-html/current/rtl/classes/tmemorystream.html or https://www.freepascal.org/docs-html/current/rtl/objects/tmemorystream.html ?

Slightly later: I think that using AssignPipe() directly is probably the best way of doing what I want.

MarkMLl

marcov:
I meant it as an example of redirecting textfile I/O to something else. Not as a direct tool to use.

Another such thing is sock2text and other "text" functions in the sockets unit.

MarkMLl:

--- Quote from: marcov on November 29, 2022, 09:15:25 pm ---I meant it as an example of redirecting textfile I/O to something else. Not as a direct tool to use.

Another such thing is sock2text and other "text" functions in the sockets unit.

--- End quote ---

Sockets won't work directly, because of the necessity of separating the text and control flow. I'm reasonably happy with the pipes idea, particularly since although TextRec is opaque there's a reasonable tradition of going direct to the handle which is something that I'm likely to need for input (read characters, lines etc. with timeout). Tinkering...

Application is a backdoor/debugging interface to various apps, something that happened a few days ago relating to a blown video card and the difficulty of an alternative brought this to the fore. Some code I wrote a couple of weeks ago to support an SCPI instrumentation interface is vastly more robust than LNet which I've used for this in the past, so while I've been thinking about how to structure this for some while it's time to actually do it.

MarkMLl

Navigation

[0] Message Index

[#] Next page

Go to full version