Table of Contents

TTMSMCPStdioTransport Class

Message channel that talks to a single client over the process standard input and standard output streams.

API unit family: TMS.MCP.Transport.STDIO Inherits from: TTMSMCPTransport

Syntax

TTMSMCPStdioTransport = class(TTMSMCPTransport)

Remarks

This is the channel used when the client launches the server as a child process. One request is one line read from standard input; the answer is written back as one line on standard output. There is exactly one client for the lifetime of the process and no session identifiers are involved, so the session-aware members inherited from TTMSMCPTransport keep reporting that there are no sessions. Everything written to standard output is protocol traffic. The client parses that stream, so a stray WriteLn, a progress message, or a debug print from anywhere in the process corrupts the conversation. Send diagnostics to standard error or to a log file instead, and use TTMSMCPTransport.OnError rather than printing. Input is read one byte at a time and decoded as UTF-8; a carriage return is skipped and a line feed ends the line, so both line-ending conventions are accepted. Blank lines are ignored. Standard input is only opened on Windows, so on other platforms the channel starts but has nothing to read from.

Methods

Name Description
ProcessMessages Reads one line from standard input, has it handled, and writes the answer to standard output.
Run Starts the channel if needed and serves messages until it stops.
Start Opens the standard input stream and marks the channel as running.
Stop Marks the channel as stopped and closes the standard input stream.

Used by