Running TACL Code as a Server
Running TACL as a Server
107365 Tandem Computers Incorporated
6–5
Running TACL Code
as a Server
To provide TACL code for use by a TACL server process, you must provide a link to a
TACL process that is running your code. There are several ways to accomplish this,
including:
ASSIGN the TACLCSTM file to a TACL macro or routine that contains the code.
Include access to the code from your TACLCSTM file. (When you start a TACL
process, the process accesses your TACLCSTM file.) Your TACLCSTM file can
check #TACLOPERATION, which indicates whether a TACL process is receiving
input from an IN file (REQUESTER) or $RECEIVE (SERVER).
Process the input through a server path defined by the #SERVER built-in function,
described in Section 5, “Initiating and Communicating With Processes.”
Open the TACL process as described in Section 5.
Constructing a TACL
Server
One way to accept requests and reply with messages in a specified format is to build a
loop using #INPUTV and #REPLYV and protect it with an exception handler. Figure
6-2 shows an example a TACL program that uses an #INPUTV and #REPLYV loop.
Using #REPLYPREFIX
Pathway programs can use TACL as a server. You can use #REPLYPREFIX to prefix
each reply with a 16-bit binary code. The #REPLYPREFIX built-in variable can be
empty or it can contain any numeric value in the range 0 through 65535. If
#REPLYPREFIX is not empty, its value precedes each response; if #REPLYPREFIX is
set, replies can be up to 5002 bytes long.
Using #REPLY and #REPLYV
Normally, if the OUT file is not set to $RECEIVE, then all output is excluded from the
reply. However, #REPLY(V) forces text to be included in the reply buffer, regardless
of the setting of the OUT file.
Requests and replies (except the part generated by #REPLYPREFIX) consist of ASCII
characters with internal line breaks encoded as null bytes.
When functioning as a server, TACL stores #REPLY(V) text and, if OUT is set to
$RECEIVE, its normal output as well. TACL replies with the buffer contents when it
has processed all of the text that was included in the request. If the accumulated
response exceeds 5000 bytes, TACL discards the excess without notification.
TACL can have as many as 100 openers. All openers of a given TACL process can
never have more than one message outstanding to TACL at a time, unless the
processes have opened TACL without a #SERVER name.