This section describes the protocol used by the client and server for communication. A server program that implements this protocol should be accessible from the xnet module.
When an slisp program is started up in server mode with the -s flag it first outputs some arbitrary text followed by <end_char>, where <end_char> is the default delimeter. The Lisp function NET-CONNECT looks for any arbitrary text followed by <end_char> in order to be sure a connection has made, on the assumption that an slisp server always outputs at least the copyright message. If text is not received, or if an error is found the NET-CONNECT function signals an error.
Once a connection has been made the server waits for input without writing a prompt as it does in command-line mode. The client function NET-EVAL is used to send a valid Lisp expression, which the server evaluates, writing the result back to the output stream. The form of the output depends on the results of the evaluation: The output stream generated by an slisp server takes one of several forms:
<arbitrary text><data_char><valid sexpression><end_char> <arbitrary text>error: <error message><end_char> <data_char><valid sexpression><end_char> error: <error message><end_char>
<arbitrary text> is output if the server writes to the terminal with functions such as PRINT or FORMAT before returning a value.
<data_char> is a control character that signals the start of valid data.
<valid sexpression> is a valid expression returned as a result of evaluating the input expression. This expression is in a form that can be assigned to a Lisp variable in the client.
<end_char> is a control character that signals the end of the data.
Both <data_char> and <end_char> should be control characters that do not occur in any other parts of the server output. Current default decimal ASCII values are: <data_char> = 4, <end_char> = 3.